I have
private static final BigDecimal ONE_HUNDRED = new BigDecimal(100);
private static final BigDecimal TEN = new BigDecimal(10);
BigDecimal decimal = new BigDecimal(1050);
I need to get 10% I write
BigDecimal decimalResult = decimal.divide(ONE_HUNDRED).multiply(TEN)//100, 10
But Intellij IDE says:
'BigDecimal.divide()' called without a rounding mode argument more...
I added BigDecimal.ROUND_HALF_UP
and all others but I get wrong result. I need 1050/100 = 10.5
but if I add BigDecimal.ROUND_HALF_UP
result = 11
.
How can I correctly divide with scale parameters?