A typical use of the
byte primitive is to read from and write to streams. See
InputStream and
OutputStream in the Java API docs.
As far as the use of bitwise operators go, there are lmiitless situations in which these might be useful. If you look at the fifth post from the bottom in
this thread from the "Programming Diversions" forum, you will see the bitwise operators used quite a bit in the CharacterGrid2 class.
In that class I am using a single int (32 bits) to store a grid reference made up of two 16 bit numbers. That is, I'm packing two 16 bit values into one 32 bit value. In order to manipulate the individual components of this packed grid reference, bitwise operations are required.
Here's the bit of code from that class which takes a row and a column coordinate (positive or negative) no larger than 15 bits in size and packs them into a single 32 bit int.
Retrieving the individual row and column components from a packed reference:
HTH,
Jason