src/main/java/org/jivesoftware/whack/util/StringUtils.java
public static final String encodeHex(byte[] bytes) {
        StringBuffer buf = new StringBuffer(bytes.length * 2);
        int i;

        for (i = 0; i < bytes.length; i++) {
            if (((int) bytes[i] & 0xff) < 0x10) {
                buf.append("0");
            }
            buf.append(Long.toString((int) bytes[i] & 0xff, 16));
        }
        return buf.toString();
    }
public static final String encodeHex(byte[] bytes) {
        StringBuffer buf = new StringBuffer(bytes.length * 2);
        int i;

        for (i = 0; i < bytes.length; i++) {
            if (((int) bytes[i] & 0xff) < 0x10) {
                buf.append("0");
            }
            buf.append(Long.toString((int) bytes[i] & 0xff, 16));
        }
        return buf.toString();
    }
public static final String encodeHex ( byte [ ] bytes ) { StringBuffer buf = new StringBuffer ( bytes . length * 2 ) ; int i ; for ( i = 0 ; i < bytes . length ; i ++ ) { if ( ( ( int ) bytes [ i ] & 0xff ) < 0x10 ) { buf . append ( "0" ) ; } buf . append ( Long . toString ( ( int ) bytes [ i ] & 0xff , 16 ) ) ; } return buf . toString ( ) ; }
Turns an array of bytes into a String representing each byte as an
unsigned hex number.
<p>
Method by Santeri Paavolainen, Helsinki Finland 1996<br>
(c) Santeri Paavolainen, Helsinki Finland 1996<br>
Distributed under LGPL.

@param bytes
an array of bytes to convert to a hex-string
@return generated hex string
Turns an array of bytes into a String representing each byte as an unsigned hex number . <p > Method by Santeri Paavolainen Helsinki Finland 1996<br > ( c ) Santeri Paavolainen Helsinki Finland 1996<br > Distributed under LGPL .