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;
}

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 ; }
converts a hex string to byte [ ] . will convert full bytes only , odd number of hex characters will have a leading ' 0 ' added . big endian .
