Java Reference
In-Depth Information
We can make use of the OR to change the uppercasing program into a lowercasing pro-
gram, as shown here:
The output from this program is shown here:
The program works by ORing each character with the value 32, which is 0000 0000 0010
0000 in binary. Thus, 32 is the value that produces a value in binary in which only the 6th
bit is set. When this value is ORed with any other value, it produces a result in which the
6th bit is set and all other bits remain unchanged. As explained, for characters this means
that each uppercase letter is transformed into its lowercase equivalent.
An exclusive OR, usually abbreviated XOR, will set a bit on if, and only if, the bits being
compared are different, as illustrated here:
Search WWH ::




Custom Search