Here you can find the source of lpad(String s, char addChar, int length)
public static String lpad(String s, char addChar, int length)
//package com.java2s; //License from project: Apache License public class Main { public static String lpad(String s, char addChar, int length) { StringBuffer val = new StringBuffer(); int currLength = s.length(); for (int i = currLength; i < length; i++) { val.append(addChar); }// w ww . ja v a 2 s . com return val.append(s).toString(); } }