Java FileWriter Write saveData(String fileName, double totalTime, int[] resultSubset)

Here you can find the source of saveData(String fileName, double totalTime, int[] resultSubset)

Description

save Data

License

Open Source License

Declaration

public static void saveData(String fileName, double totalTime, int[] resultSubset) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static void saveData(String fileName, double totalTime, int[] resultSubset) throws IOException {
        FileWriter fw = null;//  w  ww . j av a  2 s.c om
        fw = new FileWriter(fileName);
        String str1 = "totalTime is:" + totalTime + "\n";
        String str2 = "resultSubset: " + "\n";
        fw.write(str1);
        fw.write(str2);
        String str = "";
        for (int i = 0; i < resultSubset.length; i++) {
            str = str + i + " ";
            if (i % 30 == 0 && i != 0)
                str = str + "\n";
        }
        fw.write(str);
        str = "\nlength of result subset is:" + resultSubset.length + "\n";
        fw.write(str);
        fw.close();
    }

    public static void saveData(String fileName, double totalTime, Integer[] resultSubset) throws IOException {
        FileWriter fw = null;
        fw = new FileWriter(fileName);
        String str1 = "totalTime is:" + totalTime + "\n";
        String str2 = "resultSubset: " + "\n";
        fw.write(str1);
        fw.write(str2);
        String str = "";
        for (int i = 0; i < resultSubset.length; i++) {
            str = str + i + " ";
            if (i % 30 == 0 && i != 0)
                str = str + "\n";
        }
        fw.write(str);
        str = "\nlength of result subset is:" + resultSubset.length + "\n";
        fw.write(str);
        fw.close();
    }
}

Related

  1. saveColumn(int[] density, String filename)
  2. saveConfig(File conf, Map data)
  3. saveContent(String context, String filename)
  4. saveData(Map> data, File file)
  5. saveData(Map> data, String file)
  6. saveDictionary(String fileName, Map values)
  7. saveDotGraph(final String dotGraph, final File outputDirectory)
  8. saveDoubleArray2File(Double[] doubleArray, String fileName)
  9. saveDoubleArray2FileAppend(Double[] doubleArray, String fileName)