1Have a look at org.apache.commons.lang.StringUtils#rightPad(String str, int size, char padChar).
2
3But the algorithm is very simple (pad right up to size chars):
4
5public String pad(String str, int size, char padChar)
6{
7 StringBuilder padded = new StringBuilder(str);
8 while (padded.length() < size)
9 {
10 padded.append(padChar);
11 }
12 return padded.toString();
13}