I know that in python binascii.unhexlify(initValue)
return the binary data represented by the hexadecimal string back.
I am trying to convert binascii.unhexlify(initValue) to java.
I tried the following code lines in java but I am getting different results then the code in python:
DatatypeConverter.parseHexBinary(value);
I run the following example:
my input - hexadecimal string:
value = '270000f31d32d1051400000000000000000000000006000000000000000000000000000000000000'
when running in python:
result = binascii.unhexlify(value)
I am getting:
result = "'\x00\x00\xf3\x1d2\xd1\x05\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
when running in java:
byte[] bytes = DatatypeConverter.parseHexBinary(value);
I am getting:
bytes = [39, 0, 0, -13, 29, 50, -47, 5, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1.why I am getting different results?
- why do I get the output in python with '\' marks?