forked from Kartikey0205/Colege-JavaLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp02Bitwise.java
More file actions
16 lines (14 loc) · 755 Bytes
/
p02Bitwise.java
File metadata and controls
16 lines (14 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class p02Bitwise {
public static void main(String args[]) {
int a = 8, b = 9;
System.out.println("Bitwise AND of a and b is " + (a & b));
System.out.println("Bitwise OR of a and b is " + (a | b));
System.out.println("Bitwise XOR of a and b is " + (a ^ b));
System.out.println("Bitwise NOT of a is " + (~a));
System.out.println("Bitwise NOT of b is " + (~b));
System.out.println("Bitwise LEFT-SHIFT of a and b is " + (a << b));
System.out.println("Bitwise RIGHT-SHIFT of a and b is " + (a >> b));
System.out.println("Bitwise RIGHT-SHIFT WITH ZERO-FILL of a is " + (a >>> 2));
System.out.println("Bitwise RIGHT-SHIFT WITH ZERO-FILL of b is " + (a >>> 2));
}
}