Java—十进制数对n进制数转换

import java.math.BigInteger;
import java.util.Scanner;

/**
* @auther Aohui
* @create 2019-11-06-15:33
*/
public class test110601 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
while(in.hasNext()){
String str=in.nextLine();
BigInteger num=new BigInteger(str);
String result=num.toString(2);//此处为十进制转化为2进制
System.out.println(result);
}
in.close();
}
}

猜你喜欢

转载自www.cnblogs.com/aoh8/p/11807566.html