Java tutorial
//package com.java2s; import java.io.File; import java.io.FileOutputStream; public class Main { public static void writeFile(File f, byte[] bS) throws Exception { if (f.isFile() && f.exists()) { f.delete(); } FileOutputStream fos = new FileOutputStream(f); fos.write(bS, 0, bS.length); fos.flush(); fos.close(); } }