Here you can find the source of leftPad(String str, String character, int size)
public static String leftPad(String str, String character, int size)
//package com.java2s; //License from project: Apache License public class Main { public static String leftPad(String str, String character, int size) { if (str != null) { int delta = size - str.length(); for (int i = 0; i < delta; i++) { str = character + str;// w ww. j a v a 2 s . c o m } } return str; } }