记录学习过程中的点点滴滴
java–BigInteger to Integer转化
从Integer到BigInteger转化直接,因为BigInteger的位数大于Integer.
今天遇到了从BigInteger到Integer的转化,直接强制类型转为会出错,需要用BigInteger类的intValue()函数来获得Integer值
BigInteger bigValue = 1111111;
Integer intValue = bigValue.intValue();
另外一种方式是 intValue = Integer.valueOf(bigValue.toString);//通过string来转化
本文地址:http://www.yaronspace.cn/blog/index.php/archives/343
来自yaronspace.cn 本文链接:http://yaronspace.cn/blog/archives/343您可能对下面文章也感兴趣:
这篇文章由admin于2009 年 12 月 24 日 18:00发表在Java。你可以订阅RSS 2.0 也可以发表评论或引用到你的网站。 |