code: static private byte[] readBinaryFile(String fileName) throws IOException {
      ByteArrayOutputStream ous = null;
      InputStream ios = null;
      try {
        byte[] buffer = new byte[4096];
        ous = new ByteArrayOutputStream();
        ios = new FileInputStream(new File(fileName));
        int read;
        while ((read = ios.read(buffer)) != -1) {
          ous.write(buffer, 0, read);
        }
      }
      finally {
        try {
          if (ous != null)
            ous.close();
        }
        catch (IOException ignore) {}
  
        try {
          if (ios != null)
            ios.close();
        }
        catch (IOException ignore) {}
      }
      return ous.toByteArray();
    }
docs: Read a file into a string.
  @param fileName File to read.
  @return Byte contents of file.