moved code from coursera algo1 project to all java project