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。