Permutation { public int firstIndexOfDifference(Permutation other) { int r = 0; while ((r < values.length) && values[r] == other.get(r)) { r++; } return r; } Permutation(int size);  Permutation(int... values);  Permutation(Permutation other); @Override boolean equals(Object other); @Override int hashCode(); boolean isIdentity(); int size(); int get(int index); int[] getValues(); int firstIndexOfDifference(Permutation other); List<Integer> getOrbit(int element); void set(int index, int value); void setTo(Permutation other); Permutation multiply(Permutation other); Permutation invert(); String toCycleString(); @Override String toString();  }
@Test public void firstIndexDiffTest() { int[] valuesA = new int[]{1, 0, 3, 2}; int[] valuesB = new int[]{1, 0, 2, 3}; Permutation a = new Permutation(valuesA); Permutation b = new Permutation(valuesB); Assert.assertEquals(2, a.firstIndexOfDifference(b)); }