Here you can find the source of leftPad(final String value, final int length, final char paddingChar)
public static String leftPad(final String value, final int length, final char paddingChar)
//package com.java2s; //License from project: Open Source License public class Main { public static String leftPad(final String value, final int length, final char paddingChar) { final StringBuilder sb = new StringBuilder(value); while (sb.length() < length) { sb.insert(0, paddingChar);//from w w w . j a v a2s . c om } return sb.toString(); } }