【Java】进制十进制转七进制

public static String toSeven(int number) {

String result = "";

String remain = "";

while (number >= 7) {

remain = String.valueOf(number % 7); // 1

number = number / 7;

result = remain + result;

}

return String.valueOf(number) + result;

}


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-BlogPHP 1.5.2 Zero

粤ICP备18035038号