static byte[] hexStringToByteArray(String hexString){
  String s=hexString;
  int len=s.length();
  if (len % 2 == 1) {
    s="0" + s;
    len++;
  }
  byte[] data=new byte[len / 2];
  for (int i=0; i < len; i+=2) {
    data[i / 2]=(byte)((Character.digit(s.charAt(i),16) << 4) + Character.digit(s.charAt(i + 1),16));
  }
  return data;
}

static byte [ ] hexStringToByteArray ( String hexString ) { String s = hexString ; int len = s . length ( ) ; if ( len % 2 == 1 ) { s = "0" + s ; len ++ ; } byte [ ] data = new byte [ len / 2 ] ; for ( int i = 0 ; i < len ; i += 2 ) { data [ i / 2 ] = ( byte ) ( ( Character . digit ( s . charAt ( i ) , 16 ) << 4 ) + Character . digit ( s . charAt ( i + 1 ) , 16 ) ) ; } return data ; }
converts a hexadecimal string into an byte array
