java如何对两个超大数相加
public class Test{
public static void main(String[] args){
String a="123456789123456789";
String b = "123456789123456789" ;
java.math.BigInteger a2 = new java.math.BigInteger(a);
java.math.BigInteger b2 = new java.math.BigInteger(b);
java.math.BigInteger result=a2.add(b2);
System.out.println (result );
}
}
public static void main(String[] args){
String a="123456789123456789";
String b = "123456789123456789" ;
java.math.BigInteger a2 = new java.math.BigInteger(a);
java.math.BigInteger b2 = new java.math.BigInteger(b);
java.math.BigInteger result=a2.add(b2);
System.out.println (result );
}
}