/** * 將數字格式化為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; }