日期:2014-05-20  浏览次数:20566 次

java大整数的运算问题,谢谢了
我问一下,在java中怎么实现大的整数(超过int范围的)的加法,乘法运算呢?有哪些实现办法?请给我个完整的算法吧,谢谢了?

------解决方案--------------------
Biginteger add(Bogomteger other)加
Biginteger multiply(Bogomteger other)乘
------解决方案--------------------
import java.math.BigInteger;;
public class hhh {
public static void main(String [] args){
BigInteger a=new BigInteger( "4321321213212132 ");
BigInteger b=new BigInteger( "78968979898 ");
BigInteger c=a.add(b);
BigInteger d=a.multiply(b);
System.out.println( "c= "+c);
System.out.println( "d= "+d);
}
}