I am trying to convert a larger value of hex string into bytes. The information which is get about converting signed bytes is the max is 0x7F equals to 127 only. But now mine I want to convert hexa value C6 into bytes which i should receive 198. Are there any ways to do this?
Currently I have tested my code using this methods:
static byte[] bytearray = {0x02, 0x08, 0x16, 0x00, 0x00, 0x33, (byte)(Integer.parseInt("C6",16) & 0xff), 0x1B};
static byte[] bytearray = {0x02, 0x08, 0x16, 0x00, 0x00, 0x33, (byte)0xC6, 0x1B};
All of this method giving me the same value -58 only.
I appreciate if someone can help me with this. Thank you