Is there an easy and elegant way to convert an unsigned byte value to a signed byte value in java? For example, if all I have is the int value 240 (in binary (24 bits + 1111
Java does not have unsigned values, except for char. Consider this snippet:
char
byte val = (byte)255; System.out.println(String.valueOf(val));
The result will be -1, because the lowest 8 bits got copied over to the byte variable.