2007-03-02

DecimalFormat使用

java 代码
  1. @SuppressWarnings("unused")   
  2. private String encoding(Long count, long width) {   
  3.     // String code = "000000";   
  4.     java.text.DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance();   
  5.   
  6.     String str = "";   
  7.     for (int i = 0; i < width; i++) {   
  8.         str += "0";   
  9.     }   
  10.   
  11.     nf.applyPattern(str);   
  12.   
  13.     return nf.format(count.longValue());   
  14. }  

最近很郁闷,贴点代码记住!

评论
发表评论

您还没有登录,请登录后发表评论

bingxue2332
搜索本博客
最近加入圈子
存档
最新评论
评论排行榜