Algorithms using Java