Integer data types in Java represent signed integer values, that is, both positive and negative integer values. The values of `char` type can effectively be regarded as unsigned 16-bit integers.

Values of type `byte` are represented as shown in Table G.2. A value of type `byte` requires 8 bits. With 8 bits, we can represent 2^{8} or 256 values. Java uses 2's complement (explained later) to store signed values of integer data types. For the `byte` data type, this means values are in the range –128 (–2^{7}) to +127 (2^{7}–1), inclusive.

Bits in an integral value are usually numbered from right to left, starting with the least significant bit `0` (also called the right-most bit). When applying bitwise operators, the number of the most significant ...

Start Free Trial

No credit card required