计算诸如-123,456,789 + 123,123的值
import java.math.BigInteger; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner cin = new Scanner(System.in); String str1, str2; BigInteger a, b; while(cin.hasNext()){ str1 = cin.next(); str2 = cin.next(); str1 = str1.replaceAll(",", ""); str2 = str2.replaceAll(",", ""); a = new BigInteger(str1); b = new BigInteger(str2); System.out.println(a.add(b)); } } }