static public void writeToFile(byte[] contents, File file) throws IOException {
    try (FileOutputStream fw = new FileOutputStream( file)) {
      fw.write(contents);
      fw.flush();
    }
  }
static public void writeToFile(byte[] contents, File file) throws IOException {
    try (FileOutputStream fw = new FileOutputStream( file)) {
      fw.write(contents);
      fw.flush();
    }
  }
static public void writeToFile ( byte [ ] contents , File file ) throws IOException { try ( FileOutputStream fw = new FileOutputStream ( file ) ) { fw . write ( contents ) ; fw . flush ( ) ; } }
Write byte[] contents to a file.

@param contents String holding the contents
@param file     write to this file (overwrite if exists)
@throws java.io.IOException on io error
Write byte [] contents to a file .