Java Language Bit Manipulation


  • Unlike C/C++, Java is completely endian-neutral with respect to the underlying machine hardware. You do not get big or little endian behavior by default; you have to explicitly specify which behavior you want.

  • The byte type is signed, with the range -128 to +127. To convert a byte value to its unsigned equivalent, mask it with 0xFF like this: (b & 0xFF).