#1
9th April 2013, 07:08 PM
| |||
| |||
BITS Java Programming
Can you give me details about Bits Java Programming?
|
#2
10th April 2013, 02:14 PM
| |||
| |||
Re: BITS Java Programming
The Java programming language also provides operators that execute bitwise and bit shift operations on integral types. The operators discussed in this section are less usually used. Therefore, their coverage is brief; the intent is to simply make you aware that these operators exist. The signed left shift operator "<<" shifts a bit pattern to the left, and The signed right shift operator ">>" shifts a bit pattern to the right The bitwise & operator performs a bitwise AND operation. The bitwise ^ operator performs a bitwise exclusive OR operation. The bitwise | operator performs a bitwise inclusive OR operation. The following program, BitDemo, uses the bitwise AND operator to print the number "2" to standard output. class BitDemo { public static void main(String[] args) { int bitmask = 0x000F; int val = 0x2222; // prints "2" System.out.println(val & bitmask); } } |