Here you can find the source of saveData(String fileName, double totalTime, int[] resultSubset)
public static void saveData(String fileName, double totalTime, int[] resultSubset) throws IOException
//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(); } }