forked from b3601993/CodeTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestInt.java
More file actions
25 lines (20 loc) · 760 Bytes
/
Copy pathTestInt.java
File metadata and controls
25 lines (20 loc) · 760 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
import org.junit.Test;
/**
* Created by Jikai Zhang on 2017/4/19.
*/
public class TestInt {
@Test
public void testNegative() {
int countBits = Integer.SIZE - 3;
System.out.println(Integer.toBinaryString(-1 << countBits));
System.out.println(Integer.toBinaryString(0 << countBits));
System.out.println(Integer.toBinaryString(1 << countBits));
System.out.println(Integer.toBinaryString(2 << countBits));
System.out.println(Integer.toBinaryString(3 << countBits));
System.out.println(-1 << countBits);
System.out.println(0 << countBits);
System.out.println((1 << countBits) - 1);
System.out.println(2 << countBits);
System.out.println(3 << countBits);
}
}