public static byte[] convertHexString(String hexString){
  if (hexString == null || hexString.length() == 0)   return null;
  int size=hexString.length() / 2;
  byte[] retValue=new byte[size];
  String inString=hexString.toLowerCase();
  try {
    for (int i=0; i < size; i++) {
      int index=i * 2;
      int ii=Integer.parseInt(inString.substring(index,index + 2),16);
      retValue[i]=(byte)ii;
    }
    return retValue;
  }
 catch (  Exception e) {
    log.finest(hexString + " - " + e.getLocalizedMessage());
  }
  return null;
}

public static byte [ ] convertHexString ( String hexString ) { if ( hexString == null || hexString . length ( ) == 0 ) return null ; int size = hexString . length ( ) / 2 ; byte [ ] retValue = new byte [ size ] ; String inString = hexString . toLowerCase ( ) ; try { for ( int i = 0 ; i < size ; i ++ ) { int index = i * 2 ; int ii = Integer . parseInt ( inString . substring ( index , index + 2 ) , 16 ) ; retValue [ i ] = ( byte ) ii ; } return retValue ; } catch ( Exception e ) { log . finest ( hexString + " - " + e . getLocalizedMessage ( ) ) ; } return null ; }
convert hex string to byte array
