int (final int[] indexes, final int len, final int val, final Comparator<? super Attribute> comp) { int left = 0, mid, right = len - 1, cmp; final Attribute base = attributeData[val]; while (left <= right) { mid = (left + right) >>> 1; cmp = comp.compare(base, attributeData[indexes[mid]]); if (cmp == 0) { while (mid < right && comp.compare(base, attributeData[indexes[mid + 1]]) == 0) { mid++; } return mid + 1; } else if (cmp < 0) { right = mid - 1; } else { left = mid + 1; } } return left; }