java BigInteger类的用法
import java.math.BigInteger; Scanner in = new Scanner(System.in); BigInteger x1 = new BigInteger("-11"); //新建一个对象 BigInteger x2 = in.nextBiginteger();//键盘输入 BigInteger y = x1.abs(); //取绝对值 BigInteger y2 = x1.add(y); //x+y int x3 = y.compareTo(x1); //x和y比较 < == >分别返回 -1,0,1 Boolean x4 = (y.compareTo(x1) <= 0); //判断y是否<=x 0是固定不变的,<=符号可以随意变 BigInteger x5 = y.divide(x1); // y/x1 BigInteger x6 = y.multiply(x1);// y*x1 double x6 = x2.doubleValue(); //将x2转化为double类型,转化为int用intValue() BigInteger x7 = x2.gcd(x1);// 返回abs(x2)和abs(x1)的最大公约数 BigInteger x8 = x2.negate();// 返回-x2 String x9 = x2.toString();// 将x2转化为字符串 BigInteger y3 = x2.reamainder(x1);// 返回x2%x1 BigInteger y4= x1.pow(2);// pow(int exponent) 返回其值为 (this^exponent) 的 BigInteger。