Here you can find the source of rightPad(String targetStr, char appendChar, int length)
public static String rightPad(String targetStr, char appendChar, int length)
//package com.java2s; //License from project: Apache License public class Main { public static String rightPad(String targetStr, char appendChar, int length) { if (targetStr == null) { return null; }//w w w . ja v a2 s . c o m int len = targetStr.length(); while (len++ < length) { targetStr += appendChar; } return targetStr; } }