forked from mohammedabdulbari/Java-SE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitwise.java
More file actions
50 lines (32 loc) · 748 Bytes
/
Bitwise.java
File metadata and controls
50 lines (32 loc) · 748 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
41
42
43
44
45
46
47
48
49
50
package bitwise;
public class Bitwise {
/*
public static void main(String[] args)
{
int a=10, b=15;
a=a^b;
b=a^b;
a=a^b;
System.out.println(a+ " "+b);
}
*/
/*
public static void main(String[] args)
{
byte a=9, b=12;
byte c;
c=(byte)(a<<4);
c=(byte)(c|b);
System.out.println((c&0b11110000)>>4);
System.out.println((c&0b00001111)>>4);
}
*/
public static void main(String[] args)
{
byte c;
c=(byte)(9<<4);
c=(byte)(c|12);
System.out.println((c&0b11110000)>>4);
System.out.println((c&0b00001111)>>4);
}
}