int (int longIndex) { checkLongIndex(longIndex); if (shortSize() == 0 || getLongIndex(0) > longIndex) return 0; int a = 0; int b = shortSize() - 1; while (b > a + 1) { int middle = (a + b) / 2; if (getLongIndex(middle) <= longIndex) { a = middle; } else { b = middle; } } return getLongIndex(b) <= longIndex ? b : a; }