Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Java 编程的初学者,我在处理 Java 编号时遇到了一些麻烦。我想创建一个带有循环的程序,它将打印整数 0 到 5 的二进制形式。
我的意思是输出应该是这样的:0000 0001 0010 0011 0100 在此先感谢您的帮助!
利用:
for ( int i = 0; i <= 5; i++ ) { System.out.println(Integer.toBinaryString(i)); }