Java – how to convert an 18 Bit numeric string to BigInteger?

Someone can help me convert an 18 digit string number into BigInteger in Java

Namely; The string "0x999999999999999999" should be displayed as a value of 0x9999999999999999

Solution

You can specify the cardinality in the BigInteger constructor

BigInteger bi = new BigInteger("9999999999999999",16);
String s = bi.toString(16);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>