| | |
| | | public static BigDecimal mul2(BigDecimal d1, BigDecimal d2) { // 进行乘法运算
|
| | | return d1.multiply(d2).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | |
| | | public static BigDecimal mul(BigDecimal d1, BigDecimal d2,int scale) { // 进行乘法运算
|
| | | return d1.multiply(d2).setScale(scale, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | |
|
| | | public static BigDecimal div(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | 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 div(BigDecimal d1, BigDecimal d2,int scale) {// 进行除法运算
|
| | | return d1.divide(d2, scale, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | |
|
| | | public static BigDecimal getWithNoZera(BigDecimal num) {// 进行除法运算
|
| | | while (num.toString().endsWith("0") && num.toString().indexOf(".") > -1) {
|