You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
firstwork/jinzhi-lj.java

13 lines
332 B

class jinzhi_lj {
public static void main(String[] args) {
int n = 15;
int x=0;
int i=0;
while (n > 0) {
x = (int) (x + (n % 2) * Math.pow(10,i));
n = n / 2;
i=i+1;
}
System.out.print("十进制n转换二进制a为" + x);
}
}