simplify some loops
remove unused import
use stringbuilder instead of stringbuffer
use string concatenation when no string builder is necessary (compiler will do it for us, and it makes our code easier to read)
use isEmpty
use foreach loops
remove deadcode