Java tutorial
//package com.java2s; public class Main { public static String padLeft(String s, int n, String c) { return String.format("%1$" + n + "s", s).replaceAll(" ", c); } }