包的导入:
import java.math.BigInteger;
将数据转化为BigInteger类型:
int a=3;
int b=8;
BigInteger n=BigInteger.valueOf(a);
BigInteger m=BigInteger.valueOf(b);
定义BigInteger类型的数据:
BigInteger n=new BigInteger("3");
BigInteger m=new BigInteger("8");
BigInteger数据的运算
System.out.println(m.add(n));//加法
System.out.println(m.subtract(n));//减法
System.out.println(m.multiply(n));//乘法
System.out.println(m.divide(n));//相除取整
System.out.println(m.remainder(n));//取余
//System.out.println(m.pow(n));//n需要为int型
System.out.println(m.gcd(n));//最大公约数
System.out.println(m.abs());//取绝对值
System.out.println(m.negate());//取反数
System.out.println(m.mod(n));