question: public static byte [ ] hexStringToByte ( String hexString ) { if ( ( hexString . length ( ) & 1 ) == 1 ) hexString = '0' + hexString ; byte [ ] tmp = new byte [ hexString . length ( ) / 2 ] ; for ( int i = 0 ; i < tmp . length ; ++ i ) { String hexByte = hexString . substring ( i * 2 , i * 2 + 2 ) ; tmp [ i ] = ( byte ) Integer . parseInt ( hexByte , 16 ) ; } return tmp ; }
target:  Converts a hex String to byte[]. Will convert full bytes only, odd number of hex characters will have a leading '0' added. Big endian.