📄 e130. parsing and formatting a big integer into binary, octal, and hexadecimal.txt
字号:
BigInteger bi = new BigInteger("1023");
// Parse and format to binary
bi = new BigInteger("1111111111", 2); // 1023
String s = bi.toString(2); // 1111111111
// Parse and format to octal
bi = new BigInteger("1777", 8); // 1023
s = bi.toString(8); // 1777
// Parse and format to decimal
bi = new BigInteger("1023"); // 1023
s = bi.toString(); // 1023
// Parse and format to hexadecimal
bi = new BigInteger("3ff", 16); // 1023
s = bi.toString(16); // 3ff
// Parse and format to arbitrary radix <= Character.MAX_RADIX
int radix = 32;
bi = new BigInteger("vv", radix); // 1023
s = bi.toString(radix); // vv
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -