Here you can find the source of rightPad(String str, int len, char c)
public static String rightPad(String str, int len, char c)
//package com.java2s; //License from project: Open Source License public class Main { public static String rightPad(String str, int len, char c) { if (str.length() >= len) return str; StringBuilder ret = new StringBuilder(str); while (ret.length() < len) ret.append(c);/*from w w w.j av a 2s . com*/ return ret.toString(); } public static String rightPad(String str, int len) { return rightPad(str, len, ' '); } }