Java tutorial
//package com.java2s; import java.io.FileOutputStream; public class Main { public static void data2file(byte[] w, String fileName) throws Exception { FileOutputStream fos = null; try { fos = new FileOutputStream(fileName); fos.write(w); fos.close(); } catch (Exception e) { if (fos != null) fos.close(); throw e; } } }