A single byte takes up four bytes of space inside the Java virtual machine(32 bit processor).
Yes,we can use an array of byte which would occupy only the amount of space it actually needs. But I want to use a single byte not an array of bytes.
So,is there any type in Java to represent an 8 bit datum.
A single
bytecan be allocated more than a single byte of storage, for memory alignment reasons.Do not worry about the target processor. An array of 10000
bytes will be stored in approximately 10000 bytes of space.