Java tutorial
//package com.java2s; public class Main { public static String paddLeft(String src, int length, char padding) { return String.format("%" + length + "s", src).replace(' ', padding); } }