标签:blog class code java ext int
计算诸如-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)); } } }
Java中String类与Integer类的几个方法,布布扣,bubuko.com
标签:blog class code java ext int
原文地址:http://blog.csdn.net/chang_mu/article/details/24888635