yujian
2019-08-22 33bfa1b3d03236922cc95b9435d7d10c91e8c4e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package org.yeshi.utils;
 
import java.math.BigDecimal;
 
public class BigDecimalUtil {
 
    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));
            return getWithNoZera(num);
        }
        return num;
    }
 
}