UnsignedByteExample -- using all 8 bits of a byte
as an unsigned value.
To see this example in action:
- Compile the Java source file, UnsignedByteExample.java:
javac UnsignedByteExample.java
- Run the class:
java UnsignedByteExample
Output:
i1 = -4
i2 = 252
-4
252
b + 1 = -3
(b & 0xFF) + 1 = 253
The source.