public static String unicodeToHexString(final String unicodeString) {
    Preconditions.checkNotNull(unicodeString, "Error: Unicode string can't be null");

    final StringBuffer sb = new StringBuffer();

    for (final byte b : unicodeString.getBytes()) {
      sb.append(String.format("%X00", b));
    }

    return sb.toString();
  }
Converts an unicode string to a hex string.

@param unicodeString The unicode string to convert.
@return The hex string.
java/zylib/src/main/java/com/google/security/zynamics/zylib/general/Convert.java