Here you can find the source of fileWriteBytes(byte[] data, String file)
public static void fileWriteBytes(byte[] data, String file) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class Main { public static void fileWriteBytes(byte[] data, String file) throws IOException { File f = new File(file); if (f.exists()) if (!f.delete()) throw new IOException("Unable to delete file."); Files.write(Paths.get(file), data, StandardOpenOption.CREATE, StandardOpenOption.WRITE); }/*from w ww . j a v a2 s . c om*/ }