I have the following function, which iterates through an array, calls a method for each Return object that returns a BigDecimal that contains some value, for example. 20.45:
private String getTransactionTotals(Refund[] refunds) { BigDecimal total = new BigDecimal(0.00); for ( Refund refund : refunds ) { total.add(refund.getAmountPayable()); } total = total.setScale(2, RoundingMode.CEILING); return total.toString(); }
The problem is that it always returns "0.00". I know that the array I'm passing is not null, and the values ββthat their getAmountPayable () 'functions are also non-zero. I don't know if I have been looking at this for too long, and I miss the obvious, some help would be greatly appreciated.
PS - 'getAmountPayble ()' returns a value of type BigDecimal
source share