GeometricDoubleBondEncoderFactory implements StereoEncoderFactory { static int[] moveToBack(int[] neighbors, int v) { int j = 0; for (int i = 0; i < neighbors.length; i++) { if (neighbors[i] != v) { neighbors[j++] = neighbors[i]; } } neighbors[neighbors.length - 1] = v; return neighbors; }  @Override StereoEncoder create(IAtomContainer container, int[][] graph);  }
@Test public void testMoveToBack() throws Exception { assertThat(moveToBack(new int[]{0, 1, 2}, 0), is(new int[]{1, 2, 0})); assertThat(moveToBack(new int[]{0, 1, 2}, 1), is(new int[]{0, 2, 1})); assertThat(moveToBack(new int[]{0, 1, 2}, 2), is(new int[]{0, 1, 2})); assertThat(moveToBack(new int[]{0, 1, 2, 4, 5, 6}, 2), is(new int[]{0, 1, 4, 5, 6, 2})); }