10进制小数转换成n进制JAVA,Java—十进制数对n进制数转换

c4468b3f4df77e96b0a416fa2a870fba.png

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();

}

}

原文链接:https://www.cnblogs.com/aoh8/p/11807566.html

如有疑问请与原作者联系

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有