Java Reference
In-Depth Information
76543210 bits
Printers field:
00 = 0 printers
01 = 1 printer
10 = 2 printers
11 = 3 printers
Mouse present bit:
0 = no mouse
1 = mouse installed
Serial ports field:
000 = 0 serial ports
001 = 1 serial port
010 = 2 serial ports
...
111 = 7 serial ports
MMX present bit:
0=noMMX
1 = MMX available
UNUSED
Figure8-1BitmappedData
Theoperationofassigningindividualbitsandbitfieldsiscalled
bitmapping.Anotheradvantageofbitmappeddataisthatseveralitemsof
informationcanbeencodedinasinglestorageelement.Sincebitmapped
dataismorecompact,itiseasiertopassandretrieveinformation.Forex-
ample,youcoulddevoteabytevariabletostorethebitmappeddatain
Figure8-1 .Thevariablecouldbedefinedasfollows:
bytesystemDevices;
Inordertomanipulatebitmappeddatayoumustbeabletoaccessindi-
vidualbitsandbitfields.ThisisthefunctionoftheJavabitwiseopera-
tors.
In Table8-2 , theoperators&,|,^,and~performbitwisefunctionson
individual bits. The convention that a binary 1 corresponds to logical
true, and a binary 0 to false, allows using binary numbers to show the re-
sults of a logical or bitwise operation. For example:
 
Search WWH ::




Custom Search