Bytes do not have “storage” representation in JVM,...
# announcements
o
Bytes do not have “storage” representation in JVM, and they are signed, so they are loaded into “int”-size locals (or fields) with I2B instruction, which is sign-aware. Thus, if you have
0xFA.toByte()
you actually get byte with
-6
value. Since it is stored in int-slot, it is stored as 0xFFFA, and thus when converted to char with I2C bytecode instruction happens to be
\uFFFA
and not
\u00FA
as you would expect.