Here you can find the source of leftPadWithZeros(String input, int expectedSize)
public static String leftPadWithZeros(String input, int expectedSize)
//package com.java2s; //License from project: Apache License public class Main { private static final String ZERO = "0"; public static String leftPadWithZeros(String input, int expectedSize) { if (input == null) { return leftPadWithZeros("", expectedSize); }// ww w . j a v a2 s.c o m StringBuilder sb = new StringBuilder(expectedSize); for (int i = expectedSize - input.length(); i > 0; i--) { sb.append(ZERO); } sb.append(input); return sb.toString(); } }