public BigInteger(String val)
BigInteger twoInstance = new BigInteger ("2");
public BigInteger add(BigInteger val):做加法运算 public BigInteger subtract(BigInteger val):做减法运算 public BigInteger multiply(BigInteger val):做乘法运算 public BigInteger divide(BigInteger val):做除法运算 public BigInteger remainder(BigInteger val):做取余操作 public BigInteger pow(int exponet):进行取参数的 exponet 次方操作 public BigInteger negate():取相反数 public BigInteger shiftLegt(int n):将数字左移 n 位,如果 n 为负数,做右移操作 public BigInteger shiftRight(int n):将数字右移 n 位,如果 n 为负数,做左移操作 public int compareTo(BigInteger val):做数字比较操作 public BigInteger max(BigInteger val):返回较大的数值
public static void main(String[] args) {
BigInteger bigInstance = new BigInteger("4"); //实例化一个大数字
//取该大数字加2的操作
System.out.println("加法操作:"+
bigInstance.add(new BigInteger("2")));
//取该大数字减2的操作
System.out.println("减法操作:"+
bigInstance.subtract(new BigInteger("2")));
//取该大数字乘以2的操作
System.out.println("乘法操作:"+
bigInstance.multiply(new BigInteger("2")));
//取该大数字除以2的操作
System.out.println("除法操作:"+
bigInstance.divide(new BigInteger("2")));
//取该大数字除以3的商
System.out.println("取商:"+
bigInstance.divideAndRemainder(new BigInteger("3"))[0]);
//取该大数字除以3的余数
System.out.println("取余数:"+
bigInstance.divideAndRemainder(new BigInteger("3"))[1]);
//取该大数字的2次方
System.out.println("做2次方操作:"+
bigInstance.pow(2));
//取该大数字的相反数
System.out.println("取相反数操作:"+
bigInstance.negate());
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有