//统一对末尾带0的小数做去除处理,例如:10.00->10,10.90->10.9,10.98->10.98。
public static final DecimalFormat FORMATER = new DecimalFormat("##0.##");
然后调用FORMATER.format(Object o)方法。如:
BigDecimal lastPayAmount = new BigDecimal(price).subtract(new BigDecimal(firstPayAmount))
.setScale(2, BigDecimal.ROUND_HALF_UP);
return FORMATER.format(lastPayAmount);