public static String encodeHex ( byte [ ] bytes ) { StringBuilder hex = new StringBuilder ( bytes . length * 2 ) ; for ( byte aByte : bytes ) { if ( ( ( int ) aByte & 0xff ) < 0x10 ) { hex . append ( "0" ) ; } hex . append ( Integer . toString ( ( int ) aByte & 0xff , 16 ) ) ; } return hex . toString ( ) ; }
Encodes an array of bytes as String representation of hexadecimal .