int (int start1, int count1, int start2, int count2) { final int size = Math.min(count1, count2); int idx = 0; for (int i = 0; i < size; i++) { if (!(myFirst[start1 + i] == mySecond[start2 + i])) break; ++idx; } return idx; }