| | |
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | | 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; |
| | | } |
| | | |
| | | } |