Here you can find the source of writeBytesToFile(File destination, byte[] bytes)
public static synchronized void writeBytesToFile(File destination, byte[] bytes) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static synchronized void writeBytesToFile(File destination, byte[] bytes) throws FileNotFoundException, IOException { OutputStream fos = new BufferedOutputStream(new FileOutputStream(destination)); fos.write(bytes);//from ww w . j ava 2s . co m fos.close(); fos.flush(); } }