Java tutorial
//package com.java2s; public class Main { public static String padLeft(String src, char c, int len) { StringBuilder s = new StringBuilder(); for (int i = 0; i < len - src.length(); i++) s.append(c); s.append(src); return s.toString(); } }