Here you can find the source of saveFile(final File file, final byte[] dataToSave)
private static boolean saveFile(final File file, final byte[] dataToSave) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static boolean saveFile(final File file, final byte[] dataToSave) throws IOException { final FileOutputStream fos = new FileOutputStream(file); fos.write(dataToSave);/* ww w .ja va 2 s .c o m*/ fos.close(); return true; } }