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