1. bd5.max(bd6) returns BigDecimal, it does not compare them, you can compare them with bd51.compareTo(bd6)
2. you cannot use bd5 in the comparison, unless you change bd5 or bd6. Otherwise you end up with infinite loop. Though you can change them inside the body of the loop somewhere, then you good to go with this comparison (remember to use compareTo() , not max())
3. BigDecimal is immutable, so bd51.add(BigDecimal.ONE) returns new BigDecimal, but does not change the bd51 unless you assign it a new value yourself.