BigInteger类
java.math.BigInteger类的构造方法:
1.public BigInteger(String val) throws NumberFormatException
构造一个十进制的BigInteger对象,参数val如果含有非数字字符就会发生异常;
Java中BigInteger类的常用方法:
1.public BigInteger add(BigInteger val)
返回当前大整数对象与参数val指定的大整数对象的和;
2.public BigInteger subtract(BigInteger val)
返回当前大整数对象与参数val指定的大整数对象的差;
3.public BigInteger multiply(BigInteger val)
返回当前大整数对象与参数val指定的大整数对象的积;
4.public BigInteger divide(BigInteger val)
返回当前大整数对象与参数val指定的大整数对象的商;
5.public BigInteger remainder(BigInteger val)
返回当前大整数对象与参数val指定的大整数对象的余;
6.public int compareTo(BigInteger val)
返回当前大整数对象与参数指定的大整数的比较结果,返回值是1、-1、0,分别表示当前大整数对象大于、小于或等于参数val指定的大整数;
7.public BigInteger abs()
返回当前大整数对象的绝对值;
8.public BigInteger pow(int a)
返回当前大整数对象的a次幂;
9.public String toString()
返回当前大整数对象十进制的字符串表示;
10.public String toString(int p)
返回当前大整数对象p进制的字符串表示;