在java.math包中有一个BigInteger类,就是用来实现任意长整数的运算,其中有现成的源代码。

解决方案 »

  1.   

    BigInteger provides analogues to all of Java's primitive integer operators, and all relevant methods from java.lang.Math. Additionally, BigInteger provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. 
      

  2.   

    import java.math.BigInteger;BigInteger a=new BigInteger(2);
    BigInteger b=a.pow(100);
    BigInteger c=a.pow(65);
    BigInteger d=b.multiply(c);
    d=d.substract(new Integer(1));
      

  3.   

    to:jimshen(jimshen)
    应该是BigInteger a=new BigInteger(String.valueOf(2))吧非常感谢各位的帮助,不过我的本意是自己用数据结构实现大数据的运算.
    不知哪位给点代码参考!
      

  4.   

    http://expert.csdn.net/Expert/topic/1100/1100570.xml?temp=.3787042
      

  5.   

    那你就用数组吧
    比如你需要一个n位长的整数,你就建立一个数组int[] a = new int[n-1];
    a[0]代表个位,a[1]代表十位,a[2]代表百位以此类推。运算方面估计就不用说了吧,按数位来吧,小学怎么教的加减乘除和进位就那么做