Created java file for algorithm implementation