📄 rightshifttest.java
字号:
// operators/RightShiftTest.java
// TIJ4 Chapter Operators, Exercise 11, page 116
/* Start with a number that has a binary one in the most significant position
* (hint: Use a hexadecimal constant). Using the signed right-shift operator,
* right shift it all the way through all of its binary positions each time
* displaying the result using Integer.toBinaryString().
*/
import org.greggordon.tools.*;
public class RightShiftTest {
public static void main(String [] args) {
int h = 0x10000000;
P.rintln(Integer.toBinaryString(h));
for(int i = 0; i < 28; i++) {
h >>>= 1;
P.rintln(Integer.toBinaryString(h));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -