public class HelloOOP02 { String[] str = {"104489876.80","-1883934.43","-100000000.00"}; double debit = 0.00d; @Test public void test(){ for (int i = 0; i < str.length; i++) { debit = getBigDecimalDebit(str[i],debit); } System.out.println("借方金额:"+debit); } private double getBigDecimalDebit(String string, double debit2) { BigDecimal decimal1 = new BigDecimal(string); BigDecimal decimal2 = new BigDecimal(String.valueOf(debit2)); return decimal1.add(decimal2).doubleValue(); } }