| | |
| | | }
|
| | |
|
| | | public static BigDecimal div(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | return d1.divide(d2).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | return d1.divide(d2,2, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | |
|
| | | public static BigDecimal div3(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | return d1.divide(d2, 3, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | |
| | | public static BigDecimal getWithNoZera(BigDecimal num) {// 进行除法运算
|
| | | while (num.toString().endsWith("0") && num.toString().indexOf(".") > -1) {
|
| | | num = new BigDecimal(num.toString().substring(0, num.toString().length()-1));
|