static String toHexString ( final byte b ) { String hexString = Integer . toHexString ( b & 0xFF ) ; if ( hexString . length ( ) % 2 != 0 ) { // Pad with 0 hexString = "0" + hexString ; } return hexString ; }
Converts a byte into its hexadecimal representation padding with a leading zero to get an even number of characters .