Friday, May 5, 2017

java calculate percentage from decimal values

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() + "%";
}

Available link for download