-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path19_Bitwise.java
More file actions
40 lines (28 loc) · 837 Bytes
/
19_Bitwise.java
File metadata and controls
40 lines (28 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;
class Solution {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int b = 10, res = b >> 2, rss = b >>> 2;
System.out.println(b + " " + res + " " + rss);
b =20;
b = b >> 3;
System.out.println(b);
b = 20;
b = 3 << b;
System.out.println(b);
}
}
class Solution1 {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
byte b = 30;
System.out.println(~b); // -31
b = -53;
System.out.println(~b); // 52
b = -64;
System.out.println(~b); // 63
System.out.println(34 >> 3); // 4
System.out.println(-34 >> 3); // -5
System.out.println(-34 >>> 3); // 536870907
}
}