The MMAP thing is also a good point. I believe HotSpot will compile the get methods on the MappedByteBuffer down to raw access so it shouldn't matter much for performance, in theory, but the code is still damned ugly. I never understood why they can't expose it as a byte[].
You kind of have them in Java 8, but not as primitive type.
https://blogs.oracle.com/darcy/entry/unsigned_api
I also think a very least having ubyte would be quite nice.
Apparently the reason behind the decision has to do with overflows and underflows in unsigned arithmetic.
Hotspot is just one of many Java native compilers out there , so it is better not to rely on what Hotspot does.
On the other hand, you can make use of JIT Watch or Solaris Studio debugging to see what Assembly is being generated.
> I never understood why they can't expose it as a byte[].
Maybe the official unsafe class will make this better.