I am initializing a byte[] in Java, using hexadecimal or binary notation.
It seems that auto-casting to byte is not done when the value approaches the capacity of a byte.
Solution is explicit cast to byte.
$ javac bitsandbytes/ByteBufferTest.java
bitsandbytes/ByteBufferTest.java:9: error: possible loss of precision
static byte[] byteArray = { 0xFF, (byte) 0xCC, 0xCC, 0b1000_0000, 0x2F, 0x01 };
^
required: byte
found: int
bitsandbytes/ByteBufferTest.java:9: error: possible loss of precision
static byte[] byteArray = { 0xFF, (byte) 0xCC, 0xCC, 0b1000_0000, 0x2F, 0x01 };
^
required: byte
found: int
bitsandbytes/ByteBufferTest.java:9: error: possible loss of precision
static byte[] byteArray = { 0xFF, (byte) 0xCC, 0xCC, 0b1000_0000, 0x2F, 0x01 };
^
required: byte
found: int
3 errors

byteis signed in Java, forget this.