Use StringBuffer to get the final string