Java

Java大数

 1 import java.util.*;
 2 import java.math.*;
 3 
 4 public class Main {
 5     public static void main(String args[]) {
 6         int a = 102;
 7         BigInteger x = BigInteger.valueOf(a);
 8         Scanner cin = new Scanner(System.in);
 9         while(cin.hasNext()) {
10             BigInteger y = cin.nextBigInteger();
11             BigInteger z = x.add(y);
12             z = x.multiply(y);
13             z = x.subtract(y);
14             z = x.divide(y);
15             z = x.remainder(y);
16             z = x.mod(y);
17             z = x.pow(4);
18             z = x.gcd(y);
19             z = x.abs();
20             z = x.negate();
21             System.out.println(z.equals(x));
22             String s = new String("101010");
23             BigInteger u = new BigInteger(s, 2);
24             System.out.println(u);
25             z = BigInteger.ZERO;
26             z = BigInteger.ONE;
27             z = BigInteger.TEN;
28         }
29     }
30 }
View Code
原文地址:https://www.cnblogs.com/yijiull/p/7700886.html