int (int displayIndex) { getValue(); if (myGapDisplayStarts.length == 0) return displayIndex; final int bsResult = Arrays.binarySearch(myGapDisplayStarts, displayIndex); if (bsResult >= 0) return myGapPhysicalStarts[bsResult]; int insertionIndex = -bsResult - 1; int prevPhysGapStart = insertionIndex > 0 ? myGapPhysicalStarts[insertionIndex - 1] : 0; int prevDisplayGapStart = insertionIndex > 0 ? myGapDisplayStarts[insertionIndex - 1] : 0; return displayIndex - prevDisplayGapStart + prevPhysGapStart; }