1. use StringBuilder instead of StringBuffer. 2. use foreach instead of for. 3. implement methonds in Memory.java