Rather than appending each char individually, it would be faster to append from a char [] pre-loaded with the pad character.
It may be better to forego StringBuffer entirely, and use a char [] array instead.