Java Bitwise Operators - androidpro

Bitwise operators in Java are used to perform operations on individual bits. For example,

Bitwise complement Operation of 35

35 = 00100011 (In Binary)

~ 00100011

  ________

   11011100  = 220 (In decimal)

Here, ~ is a bitwise operator. It inverts the value of each bit (0 to 1 and 1 to 0).

The various bitwise operators present in Java are:

 

Operator

Description

~

Bitwise Complement

<< 

Left Shift

>> 

Right Shift

>>> 

Unsigned Right Shift

&

Bitwise AND

^

Bitwise exclusive OR

These operators are not generally