Here you can find the source of lpad(String str, char pad, int len)
public static String lpad(String str, char pad, int len)
//package com.java2s; public class Main { public static String lpad(String str, char pad, int len) { while (str.length() < len) { str = pad + "" + str; }//from w ww. ja v a2s.c o m return str; } }