Sunday, 16 August 2015

java calculate percentage from decimal values

public String getAgegt150Per() {
BigDecimal bd3 = agegt150.divide(this.totalPayment,
RoundingMode.HALF_UP);
Integer val = bd3.multiply(new BigDecimal(100)).intValue();
if (val.intValue() == 0)
return "";
else
return val.toString() + "%";
}

2 comments: