如何将18位数字字符串转换为BigInteger? [英] How to convert an 18 digit numeric string to BigInteger?

查看:1045
本文介绍了如何将18位数字字符串转换为BigInteger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人可以帮助我将18位数字字符串数字转换为java中的BigInteger

Could anyone help me in converting an 18 digit string numeric to BigInteger in java

ie;字符串0x9999999999999999应显示为 0x9999999999999999 数值。

ie;a string "0x9999999999999999" should appear as 0x9999999999999999 numeric value.

推荐答案

你可以在BigInteger构造函数中指定基数。

You can specify the base in BigInteger constructor.

BigInteger bi = new BigInteger("9999999999999999", 16);
String s = bi.toString(16);   

这篇关于如何将18位数字字符串转换为BigInteger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆