### Similar Tutorials

# Java Bitwise Operators and Examples

Bitwise operators are Bitwise AND (&), Bitwise OR (|), Bitwise XOR (^) and Bitwise Compliment (~) Operators. In this tutorial, Left Shift (<<), Right Shift (>>) and Zero Fill Right Shift (>>>) opearators are also exemplified.

24 March 2020 0 Java**Bitwise OR, Bitwise AND and Bitwise XOR**

**Example: **These operators returns bit by bit OR, AND, XOR of input values.

a = 7 = 0111 b = 3 = 0011 ----------------Bitwise OR0111 0011 ------------ 0111 = 7Bitwise AND0111 0011 ------------ 0011 = 3Bitwise XOR0111 0011 ------------ 0100 = 4

**Bitwise Complement Operator** is a unary operator and used to inverse the bits.

**Example: **a=3

a = 0011 ~ 1100