boolean (int offsetInTag) { TextRange[] ranges = getValueTextRanges(); if (ranges.length == 0) return false; if (offsetInTag < ranges[0].getStartOffset() || offsetInTag > ranges[ranges.length - 1].getEndOffset()) return false; int i = Arrays.binarySearch(ranges, TextRange.from(offsetInTag, 0), RANGE_COMPARATOR); return i >= 0 || ranges[-i - 2].containsOffset(offsetInTag); }