Contents ...
udn網路城邦
將數字格式化為0001(缺位補0)
2011/04/19 11:18
瀏覽494
迴響0
推薦0
引用0


 /**
  * 將數字格式化為0001(缺位補0)
  *
  * @param num1 格式化的數字
  * @param type 格式化的樣態
  * @return
  */
 public static String formatCount(int num1, String type){
  String str = "";

  DecimalFormat df = new DecimalFormat(type);
  str = df.format(num1);
//  SystemOutUtil.writeSystemOut("str = " + str);
  return str;
 }

發表迴響

會員登入