Java Implementation of Basic Algorithms