Java Algorithms Class