code: public static String toHex(byte[] bytes) {
      final char[] string = new char[2 * bytes.length];
      int i = 0;
      for (byte b : bytes) {
        string[i++] = hexDigits[(b >> 4) & 0x0f];
        string[i++] = hexDigits[b & 0x0f];
      }
      return new String(string);
    }
docs: Converts the specified array of bytes to a hex string.
  @param bytes The array of bytes to convert to a string.
  @return The hexadecimal representation of <code>bytes</code>.