Common Algorithms implemented in Java