这个想法是程序将显示数字及其二进制等价物,但最后只显示数字和一个二进制文件,出了什么问题
public class Convert {
public static void main(String[] args) {
int number;
for (number = 0; number < 4095; number++) {
System.out.println("Number is :" + number);
}
System.out.print("Convert to binary is:");
System.out.print(binaryform(number));
}
private static Object binaryform(int number) {
int remainder;
if (number <= 1) {
System.out.print(number);
return null;
}
remainder = number % 2;
binaryform(number >> 1);
System.out.print(remainder); {
}
return remainder;
}
}