Here you can find the source of rightPad(String str, int length, char padding)
public static String rightPad(String str, int length, char padding)
//package com.java2s; public class Main { public static String rightPad(String str, int length, char padding) { if (str == null) { str = ""; }/* w w w . j a v a2s.com*/ if (length == 0 || str.length() > length) { return str; } for (int i = str.length(); i < length; i++) { str += padding; } return str; } }