Here you can find the source of saveFile(String file, String text)
public static final void saveFile(String file, String text)
//package com.java2s; import java.io.File; import java.io.FileOutputStream; public class Main { public static final void saveFile(String file, String text) { try {/*from w ww .j a v a 2 s . c o m*/ File f = new File(file); if (!f.exists()) f.createNewFile(); FileOutputStream fout = new FileOutputStream(f); fout.write(text.getBytes()); fout.flush(); fout.close(); } catch (Exception e) { e.printStackTrace(); } } }