42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
// operators/URShift.java
|
|
// ©2015 MindView LLC: see Copyright.txt
|
|
// Test of unsigned right shift.
|
|
import static com.mindviewinc.util.Print.*;
|
|
|
|
public class URShift {
|
|
public static void main(String[] args) {
|
|
int i = -1;
|
|
print(Integer.toBinaryString(i));
|
|
i >>>= 10;
|
|
print(Integer.toBinaryString(i));
|
|
long l = -1;
|
|
print(Long.toBinaryString(l));
|
|
l >>>= 10;
|
|
print(Long.toBinaryString(l));
|
|
short s = -1;
|
|
print(Integer.toBinaryString(s));
|
|
s >>>= 10;
|
|
print(Integer.toBinaryString(s));
|
|
byte b = -1;
|
|
print(Integer.toBinaryString(b));
|
|
b >>>= 10;
|
|
print(Integer.toBinaryString(b));
|
|
b = -1;
|
|
print(Integer.toBinaryString(b));
|
|
print(Integer.toBinaryString(b>>>10));
|
|
}
|
|
}
|
|
/* Output:
|
|
11111111111111111111111111111111
|
|
1111111111111111111111
|
|
11111111111111111111111111111111111111111111111111111111111
|
|
11111
|
|
111111111111111111111111111111111111111111111111111111
|
|
11111111111111111111111111111111
|
|
11111111111111111111111111111111
|
|
11111111111111111111111111111111
|
|
11111111111111111111111111111111
|
|
11111111111111111111111111111111
|
|
1111111111111111111111
|
|
*/
|