|
@@ -1,6 +1,7 @@
|
|
|
package com.diagbot.util;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DecimalFormat;
|
|
|
|
|
|
/**
|
|
|
* @Description: 大数工具类
|
|
@@ -58,4 +59,15 @@ public class BigDecimalUtil {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+ DecimalFormat df2 = new DecimalFormat("#0.00");
|
|
|
+ BigDecimal a = new BigDecimal(0.55);
|
|
|
+ BigDecimal b = new BigDecimal(11.55);
|
|
|
+ System.out.println(df.format(a));
|
|
|
+ System.out.println(df2.format(a));
|
|
|
+ System.out.println(df.format(b));
|
|
|
+ System.out.println(df2.format(b));
|
|
|
+ }
|
|
|
}
|