Here you can find the source of writeTextFile(File file, String[] strArray)
public static void writeTextFile(File file, String[] strArray) throws IOException
//package com.java2s; import java.io.*; public class Main { public static void writeTextFile(File file, String str) throws IOException { DataOutputStream out = null; if (null != file) { try { out = new DataOutputStream(new FileOutputStream(file)); out.write(str.getBytes()); } finally { if (out != null) { out.close();/*from w ww. ja v a2s.c o m*/ } } } } public static void writeTextFile(File file, String[] strArray) throws IOException { String str = ""; if (null != file && null != strArray) { for (int i = 0; i < strArray.length; i++) { str += strArray[i]; if (i != strArray.length - 1) str += "\r\n"; } DataOutputStream out = null; try { out = new DataOutputStream(new FileOutputStream(file)); out.write(str.getBytes()); } finally { if (out != null) { out.close(); } } } } }