code: public static boolean writeBytesToFile(byte[] bytes, File f) {
          try {
              FileOutputStream fout = new FileOutputStream(f);
              fout.write(bytes);
              fout.close();
          } catch (Exception e) {
              System.out.println("Error writing byte[] to file: "
                      + e.getMessage());
              return false;
          }
          return true;
      }
docs: Writes a byte[] to a file