Java implementation of common algorithms