Class 1, Part 2 |
Intro to Java 30-IT-396 |
|
Bitwise Operators
-
This is one of those things you'll likely find on the Sun Java Certification
exams.
-
The operators compare each bit of the left side operator with each bit
of the right side opeartor.
(XOR, NOT corrected 1/23/2002)
-
& and: returns '1' where both operators are '1'
-
| or: returns '1' where either operators is a '1'
-
^ xor (exclusive or): When one, and only one, of the expressions has
a 1 in a digit, the result has a 1 in that digit. Otherwise, the
result has a 0 in that digit.
-
~ not: returns '1' where both operators are '0'.
-
These operators shift the bits on the left of the operator by the number
on the right of the operator.
-
<< left shift
-
>> right shift
-
>>> right shift, zero fill.
-
Thank goodness that's over.
Mathematical Functions, Constants


Created by: Brandan
Jones January 4, 2002