Here you can find the source of zeroPadString(String string, int length)
public static final String zeroPadString(String string, int length)
//package com.java2s; public class Main { private static final char[] zeroArray = "0000000000".toCharArray(); public static final String zeroPadString(String string, int length) { if (string == null || string.length() > length) { return string; }/* w w w .j av a2s . c o m*/ StringBuilder buf = new StringBuilder(length); buf.append(zeroArray, 0, length - string.length()).append(string); return buf.toString(); } }