public static void writeFile(File file,byte[] data) throws IOException {
  file.createNewFile();
  file.setWritable(true);
  RandomAccessFile raf=new RandomAccessFile(file,"rw");
  try {
    raf.setLength(data.length);
    raf.seek(0);
    raf.write(data);
  }
  finally {
    raf.close();
  }
}

public static void writeFile ( File file , byte [ ] data ) throws IOException { file . createNewFile ( ) ; file . setWritable ( true ) ; RandomAccessFile raf = new RandomAccessFile ( file , "rw" ) ; try { raf . setLength ( data . length ) ; raf . seek ( 0 ) ; raf . write ( data ) ; } finally { raf . close ( ) ; } }
creates and writes a binary file
