楚落凡尘

展示金额的方法(1元-->1.00元)

 1     public static String showMoneyByTwoDecimal(String account) {
 2         DecimalFormat doubleFormatter = new DecimalFormat("#0.00");
 3         if(org.apache.commons.lang.StringUtils.isEmpty(account)) {
 4             return "0.00";
 5         } else if("0".equals(account)) {
 6             return "0.00";
 7         } else {
 8             double number = 0.0D;
 9 
10             try {
11                 number = Double.parseDouble(account);
12             } catch (Exception var5) {
13                 return account;
14             }
15 
16             return doubleFormatter.format(number / 100.0D);
17         }
18     }
19     private String dealMoney(Long money){
20         String m = "0.00";
21         if(money != null && money>0){
22             DecimalFormat doubleFormatter = new DecimalFormat("#0.00");
23             m = doubleFormatter.format(money/100d);
24         }
25         return m;
26     }

 


 

posted on 2018-12-17 20:55  楚落凡尘  阅读(283)  评论(0编辑  收藏  举报

导航