Common Algorithms written in Java