Have a look at org.apache.commons.lang.StringUtils#rightPad(String str, int size, char padChar).
But the algorithm is very simple (pad right up to size chars):
public String pad(String str, int size, char padChar)
{
StringBuilder padded = new StringBuilder(str);
while (padded.length() < size)
{
padded.append(padChar);
}
return padded.toString();
}