Are there any real life uses for the Java byte primitive type?
- by Thorbjørn Ravn Andersen
For some inexplicable reason the byte primitive type is signed in Java. This mean that valid values are -128..127 instead of the usual 0..255 range representing 8 significant bits in a byte (without a sign bit).
This mean that all byte manipulation code usually does integer calculations and end up masking out the last 8 bits.
I was wondering if there is any real life scenario where the Java byte primitive type fits perfectly or if it is simply a completely useless design decision?
EDIT: The sole actual use case was a single-byte placeholder for native code. In other words, not to be manipulated as a byte inside Java code.