Java: how to use byte literals greater than 0x7F

In Java, I can’t take a byte array of unsigned bytes (from something like Wire Shark) and put it in java .... Because I will get compilation errors, since anything more than 127 decimal / 0x07F is processed not like bytes, but as int .... IE:

byte[] protocol = { 0x04, 0x01, 0x00, 0x50, /*error*/0xc1, /*error*/0xdb, 0x1c, /*error*/0x8c, 0x4d, 0x4f, 0x5a, 0x00 }; 

You need to use a good way to handle unsigned arrays and put them in Java as literals.

+6
java literals protocols bytearray network-protocols
source share
1 answer

Pass them (byte).

+6
source share

All Articles