public static String bcdToHexString ( int encodingScheme , byte bcdByte ) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder ( ) ; byte leftNibble = ( byte ) ( bcdByte & 0xf0 ) ; leftNibble = ( byte ) ( leftNibble >>> 4 ) ; leftNibble = ( byte ) ( leftNibble & 0x0f ) ; byte rightNibble = ( byte ) ( bcdByte & 0x0f ) ; switch ( encodingScheme ) { case GenericDigits . _ENCODING_SCHEME_BCD_EVEN : case GenericDigits . _ENCODING_SCHEME_BCD_ODD : sb . append ( convertHexByteToTelcoChar ( rightNibble ) ) ; sb . append ( convertHexByteToTelcoChar ( leftNibble ) ) ; break ; default : throw new UnsupportedEncodingException ( "Specified GenericDigits encoding: " + encodingScheme + " is unsupported" ) ; } return sb . toString ( ) ; }
Converts single BCD encoded byte into String Hex representation .