code: public static void saveFile(final File file, byte[] fileContents) throws IOException {
          if (file.isDirectory()) {
              throw new IOException("Unable to save file contents as a directory.");
          }
  
          final FileOutputStream fos = new FileOutputStream(file);
          fos.write(fileContents);
          fos.flush();
          fos.close();
      }
docs: Save the data, represented as a byte array to a file
  
  @param file         The location/name of the file to be saved.
  @param fileContents The data that is to be written to the file.
  @throws IOException