public static byte[] hexStringToBytes(final String hexString){
  return DatatypeConverter.parseHexBinary(hexString);
}

public static byte [ ] hexStringToBytes ( final String hexString ) { return DatatypeConverter . parseHexBinary ( hexString ) ; }
converts a hex string to a byte array . if the hex string has an odd number of characters , a 0 is added at the end of the string . example : 414141 = > { 0x41 , 0x41 , 0x41 }
