Java tutorial
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void saveByteData(byte[] bytes, File pictureFile) throws IOException { OutputStream output = null; try { output = new FileOutputStream(pictureFile); output.write(bytes); } catch (IOException e) { e.printStackTrace(); } finally { if (output != null) { output.close(); } } } }