Permutation { public void setTo(Permutation other) { if (this.values.length != other.values.length) throw new IllegalArgumentException("permutations are different size"); for (int i = 0; i < this.values.length; i++) { this.values[i] = other.values[i]; } } 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 setToTest() { int[] values = new int[]{1, 0, 3, 2}; Permutation a = new Permutation(values); Permutation b = new Permutation(values.length); a.setTo(b); Assert.assertTrue(a.isIdentity()); }
@Test(expected = IllegalArgumentException.class) public void setToTest_differentLength() { Permutation a = new Permutation(1, 0, 2); Permutation b = new Permutation(0, 1); a.setTo(b); }