Here you can find the source of lPad(String val, int length, String padChar)
public static String lPad(String val, int length, String padChar)
//package com.java2s; //License from project: Open Source License public class Main { public static String lPad(String val, int length, String padChar) { if (val == null) return null; int len = val.length(); StringBuffer pad = new StringBuffer(""); if (length > len) { for (int i = 1; i <= length - len; i++) pad.append(padChar);// w ww .j a v a 2 s . com return pad.toString() + val; } return val; } }