refactoring
StringBuilder introduced
remove redundant initializer
indexOf() replaced with contains()