`
小小米081189
  • 浏览: 20123 次
  • 性别: Icon_minigender_2
社区版块
存档分类
最新评论

大数值

 
阅读更多
public static void main(String [] args)
{
BigInteger a=BigInteger.valueOf(100);
BigInteger b=a.add(BigInteger.valueOf(200));
BigInteger c=a.multiply(BigInteger.valueOf(3));
BigInteger d=a.subtract(BigInteger.valueOf(20));
BigInteger e=a.divide(BigInteger.valueOf(4));
System.out.println("结果是"+b);
System.out.println("结果是"+c);
System.out.println("结果是"+d);
System.out.println("结果是"+e);
//大数值 BigInteger 和BigDecimal位于java.math包中的俩个很有用的类,这     俩个类可以处理包含任意长度数字序列的数值
//BigInteger类实现了任意精度的整数运算,BigDecimal实现了任意精度的浮点数运算。
//使用静态的valueOf方法可以将普通的数值转换为大数值
//大数值之间的四则运算只能用add,subtract,multiply,divide




}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics