Here you can find the source of rightPad(String str, int num, String padStr)
public static String rightPad(String str, int num, String padStr)
//package com.java2s; //License from project: Apache License public class Main { public static String rightPad(String str, int num, String padStr) { if (num <= 0) { return str; }/*from www . j ava2 s .c om*/ StringBuilder sb = new StringBuilder(str.length() + num); sb.append(str); while (num-- > 0) { sb.append(padStr); } return sb.toString(); } }