Learning Algorithms in java