Here you can find the source of saveDoubleArray2FileAppend(Double[] doubleArray, String fileName)
public static void saveDoubleArray2FileAppend(Double[] doubleArray, String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/* w w w . j a v a 2s .co m*/ * save doubleArray to fileName, if the file exists, we just append the * double array to the file */ public static void saveDoubleArray2FileAppend(Double[] doubleArray, String fileName) throws IOException { FileWriter fw = null; fw = new FileWriter(fileName, true); String str = ""; for (int i = 0; i < doubleArray.length; i++) { str = str + doubleArray[i]; str = str + "\n"; } fw.write(str); fw.close(); } /** * save doubleArray to fileName, if the file exists, we just append this * array to the fileName */ public static void savedoubleArray2FileAppend(double[] doubleArray, String fileName) throws IOException { FileWriter fw = null; fw = new FileWriter(fileName, true); String str = ""; for (int i = 0; i < doubleArray.length; i++) { str = str + doubleArray[i]; str = str + "\n"; } fw.write(str); fw.close(); } /** * @param flag * can control append the array to the fileName or not */ public static void savedoubleArray2FileAppend(double[] doubleArray, String fileName, boolean flag) throws IOException { FileWriter fw = null; fw = new FileWriter(fileName, flag); String str = ""; for (int i = 0; i < doubleArray.length; i++) { str = str + doubleArray[i]; str = str + "\n"; } fw.write(str); fw.close(); } }