unable to sum BigDecimal in for loop java
I am trying to sum BigDecimals from a list into one result but my result remains zero even after the for loop is finished. I am trying like: BigDecimal result = BigDecimal.ZERO; for (TaxSummaryType offerTaxSummary : offerTaxSummaryList) { BigDecimal tax = offerTaxSummary.getTotalTaxAmount().getValue(); //iteration i). 1266.48 //iteration ii). 1266.48 //iteration iii). 1706.58 result.add( tax ); }… Read More unable to sum BigDecimal in for loop java