BigDecimal如何相除并保留小数后两位
作者:互联网
public static void main(String[] args) {
long aa = System.currentTimeMillis();
// System.out.println(aa);
BigDecimal a = new BigDecimal(115);
BigDecimal b = new BigDecimal(22);
BigDecimal bigDecimal = a.divide(b).setScale(2, RoundingMode.HALF_UP);
System.out.println(bigDecimal);
long bb = System.currentTimeMillis();
System.out.println(bb-aa);
}
标签:aa,BigDecimal,System,相除,println,小数,bigDecimal,out 来源: https://www.cnblogs.com/hefeng2014/p/16658310.html