java - Why aren't these two byte operations equal? -
i have following code:
bytebuffer bb = bytebuffer.allocate(totallength); bb.putshort(3); bb.putshort(0); bb.putint(3 << 15 + 0); i don't understand why putting 2 short values byte buffer isn't same second operation
try bb.putint(3 << 16 + 0) instead:)
you inspect bytebuffer with:
system.out.println(arrays.tostring(bb.array()));
Comments
Post a Comment