public static String encodeHex(byte[] bytes) {
        return DatatypeConverter.printHexBinary(bytes).toLowerCase();
    }
Turns an array of bytes into a String representing each byte as an
unsigned hex number.

@param bytes an array of bytes to convert to a hex-string
@return generated hex string
xmppserver/src/main/java/org/jivesoftware/util/StringUtils.java