code: public static byte[] getFileContents(File file) throws IOException {
      FileInputStream stream = new FileInputStream(file);
      byte[] contents = new byte[(int) file.length()];
      stream.read(contents);
      stream.close();
      return contents;
    }
docs: Reads the contents of a file into a byte array.
  @param file The <code>File</code> to read.
  @return A byte array containing the file's contents.
  @throws IOException If an error occurred while reading the file.