Here you can find the source of WriteFile(String file, String message)
public static void WriteFile(String file, String message) throws IOException
//package com.java2s; import java.io.*; public class Main { public static void WriteFile(String file, String message) throws IOException { File f = new File(file); if (!f.exists()) { f.createNewFile();//from w ww . j av a 2 s.c o m } FileOutputStream fout = new FileOutputStream(file); byte[] bytes = message.getBytes(); fout.write(bytes); fout.close(); } }