Popular algorithms implemented in java