Implementation of common algorithms in java