2010-05-29 56 views

回答

7

使用java.math.BigInteger的

使用的一个简单的例子:

import java.math.BigInteger; 

public class BigIntegerTest { 
    public static void main(String[] args) { 
     BigInteger b1 = new BigInteger("200000000000000000000000000000000001"); 
     BigInteger b2 = new BigInteger("400000000000000000000000000000000000"); 

     System.out.println(b1.multiply(b2)); 
     System.out.println(b1.bitCount()); 
     System.out.println(b1.pow(13)); 
    } 
} 
13

我建议你使用java.math.BigInteger

+0

,但我有一个麻烦 '*' opertion不允许了Java。 .math.BigInteger类型 – condinya 2010-05-29 12:01:26

+0

@Bipul您必须改用multiply()方法。 – helpermethod 2010-05-29 12:04:33

+0

因为Java不支持运算符重载..但你会有一些方便的方法:) – Jack 2010-05-29 12:26:35