PermutationGroup { public void changeBase(Permutation newBase) { PermutationGroup h = new PermutationGroup(newBase); int firstDiffIndex = base.firstIndexOfDifference(newBase); for (int j = firstDiffIndex; j < size; j++) { for (int a = 0; a < size; a++) { Permutation g = permutations[j][a]; if (g != null) { h.enter(g); } } } for (int j = 0; j < firstDiffIndex; j++) { for (int a = 0; a < size; a++) { Permutation g = permutations[j][a]; if (g != null) { int hj = h.base.get(j); int x = g.get(hj); h.permutations[j][x] = new Permutation(g); } } } this.base = new Permutation(h.base); this.permutations = h.permutations.clone(); } PermutationGroup(int size);  PermutationGroup(Permutation base);  PermutationGroup(int size, List<Permutation> generators); static PermutationGroup makeSymN(int size); int getSize(); long order(); Permutation get(int uIndex, int uSubIndex); List<Permutation> getLeftTransversal(int index); List<Permutation> transversal(final PermutationGroup subgroup); void apply(Backtracker backtracker); List<Permutation> all(); void changeBase(Permutation newBase); void enter(Permutation g); int test(Permutation permutation); @Override String toString();  }
@Test public void changeBaseTest() { int size = 4; PermutationGroup group = new PermutationGroup(size); group.enter(new Permutation(1, 0, 3, 2)); group.changeBase(new Permutation(size)); Assert.assertEquals(2, group.order()); }