A byte primitive type in Java has a size of 8 bits.
Java’s `byte` is an 8-bit signed two’s-complement integer. Its range is −128 through 127, giving it 256 possible bit patterns. The type is useful when memory matters, especially in large arrays, and it is also commonly used when processing raw binary data and network protocols.
The name can cause confusion because Java’s `byte` is not an unsigned value. A byte containing the bit pattern `11111111` represents −1 in Java’s signed interpretation, not 255. To work with values from 0 through 255, programmers often convert it with masking or use an `int` representation.
Java fixes the sizes of its integral primitive types across platforms: `short` is 16 bits, `int` is 32 bits, and `long` is 64 bits. That portability is one reason Java code behaves consistently on different hardware.