/** * Returns a cursor pointing to the first element <= x. Exposed only for testing. * @param x The value used to find the cursor. * @return The cursor. */ public Index floor(double x) { Iterator<Index> rx = allBefore(x); if (!rx.hasNext()) { return null; } Index r = rx.next(); Index z = r; while (rx.hasNext() && mean(z) == x) { r = z; z = rx.next(); } return r; }