int (int oldIndex, int newIndex, int maxLength) { int x = oldIndex; int y = newIndex; maxLength = Math.min(maxLength, Math.min(oldIndex, newIndex) + 1); while (oldIndex - x < maxLength && myFirst[myStart1 + x] == mySecond[myStart2 + y]) { --x; --y; } return oldIndex - x; }