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

 

posted @ 2017-10-20 18:10  yijiull  阅读(119)  评论(0编辑  收藏  举报