Here you can find the source of zeroFillString(String originalString, int numZeros)
public static String zeroFillString(String originalString, int numZeros)
//package com.java2s; //License from project: Open Source License public class Main { private static final int BTOL_NUM_ZEROS = 4; public static String zeroFillString(String originalString, int numZeros) { if (originalString.length() < numZeros) { int zerosToAdd = numZeros - originalString.length(); for (int i = 0; i < zerosToAdd; i++) { originalString = "0" + originalString; }// ww w.ja v a 2 s . co m } return originalString; } public static String zeroFillString(String originalString) { return zeroFillString(originalString, BTOL_NUM_ZEROS); } }