使用预定义的常量,避免实例化对象

This commit is contained in:
RuoYi
2021-05-11 10:35:49 +08:00
parent 4efad1cd1b
commit b9b2b866b2
2 changed files with 10 additions and 11 deletions

View File

@ -108,7 +108,7 @@ public class Arith
"The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
BigDecimal one = new BigDecimal("1");
BigDecimal one = BigDecimal.ONE;
return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
}
}