Here you can find the source of zeroFormat(Integer source)
public static String zeroFormat(Integer source)
//package com.java2s; public class Main { public static String zeroFormat(Integer source) { String stringSource = String.valueOf(source); if (stringSource.length() >= 3) return source + ""; return String.format("%03d", source); }/* w ww . j a v a 2 s .c o m*/ public static String zeroFormat(Integer source, Integer zeroNum) { if (zeroNum == null) zeroNum = 0; String stringSource = String.valueOf(source); if (stringSource.length() >= zeroNum) return source + ""; return String.format("%0" + zeroNum + "d", source); } }