fix redundant array creation and unnecessary type cast
remove unnecessary semicolon
Explicit type can be replaced with <>
Replace StringBuffer with StringBuilder