Good that you use a StringBuffer instead of a String. It would be even better to use a StringBuilder instead.