public static void writeBinaryFile(final File file,final byte[] data) throws IOException {
  try (FileOutputStream fos=new FileOutputStream(file)){
    fos.write(data);
  }
 }

public static void writeBinaryFile ( final File file , final byte [ ] data ) throws IOException { try ( FileOutputStream fos = new FileOutputStream ( file ) ) { fos . write ( data ) ; } }
writes a byte array to a binary file .
