ensure we really set the most sig byte when length is 8
@@ -503,8 +503,8 @@ private static void formatLongBinary(final long value, final byte[] buf,
}
if (negative) {
val ^= max - 1;
- val |= 0xff << bits;
val++;
+ val |= 0xffl << bits;
}
for (int i = offset + length - 1; i >= offset; i--) {
buf[i] = (byte) val;
