Here you can find the source of leftJustify(String str, int width)
public static String leftJustify(String str, int width)
//package com.java2s; //License from project: Open Source License public class Main { public static String leftJustify(String str, int width) { return suffix(str, width, " "); }//from ww w . j a v a2 s.co m public static String suffix(String str, int width, String with) { StringBuffer ret = new StringBuffer(str); while (ret.length() < width) ret.append(with); return ret.toString(); } }