⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rightshifttest2.java

📁 Thinking in Java第四版 课后习题的源码
💻 JAVA
字号:
// operators/RightShiftTest2.java
// TIJ4 Chapter Operator, Exercise 12, page 116 
/* Start with a number that is all binary ones. Left shift it, then use the
* unsigned right-shift operator to right shift through all of its binary
* positions, each time displaying the result using Integer.toBinarySting().
*/ 

import org.greggordon.tools.*;

public class RightShiftTest2 {
	public static void main(String [] args) {
		int h = -1;
		P.rintln(Integer.toBinaryString(h));
		h <<= 10;
		P.rintln(Integer.toBinaryString(h));
		for(int i = 0; i < 32; i++) {
			h >>>= 1;
			P.rintln(Integer.toBinaryString(h));
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -