private static int tryHexToInt ( byte b ) { if ( b >= ' ' && b <= ' ' ) return b - ' ' ; if ( b >= ' ' && b <= ' ' ) return b - ' ' + 10 ; if ( b >= ' ' && b <= ' ' ) return b - ' ' + 10 ; return - 1 ; }
Treats a byte as an ASCII character and returns it s numerical value in hexadecimal . If conversion is not possible returns - 1 .