FAQ Database Discussion Community

Convert larger value hex string into bytes using java

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...

possibly lossy conversion from int to byte

I am trying to write hexadecimal data into my serial port using java, but now I cant convert the hexadecimal data into the byte array. Here is the code which shows the error message: static byte[] bytearray = {0x02, 0x08, 0x16, 0x0, 0x00, 0x33, 0xC6, 0x1B}; This is the code...