### Question:
SumToOne { protected static int[][] getSet(int n) { ArgChecker.isTrue(n > 1, "need n>1"); if (SETS.containsKey(n)) { return SETS.get(n); } int[][] res = new int[n][]; switch (n) { case 2: res[0] = new int[] {1}; res[1] = new int[] {-1}; break; case 3: res[0] = new int[] {1, 0}; res[1] = new int[] {-1, 1}; res[2] = new int[] {-1, -1}; break; case 4: res[0] = new int[] {1, 1, 0}; res[1] = new int[] {1, -1, 0}; res[2] = new int[] {-1, 0, 1}; res[3] = new int[] {-1, 0, -1}; break; default: int n1 = n / 2; int n2 = n - n1; int[][] set1 = getSet(n1); int[][] set2 = (n1 == n2 ? set1 : getSet(n2)); res = new int[n][n - 1]; for (int i = 0; i < n1; i++) { res[i][0] = 1; System.arraycopy(set1[i], 0, res[i], 1, n1 - 1); } for (int i = 0; i < n2; i++) { res[i + n1][0] = -1; System.arraycopy(set2[i], 0, res[i + n1], n1, n2 - 1); } } SETS.put(n, res); return res; } SumToOne(int n); double[] transform(double[] fitParms); DoubleArray transform(DoubleArray fitParms); double[] inverseTransform(double[] modelParms); DoubleArray inverseTransform(DoubleArray modelParms); double[][] jacobian(double[] fitParms); DoubleMatrix jacobian(DoubleArray fitParms);  }### Answer:
@Test public void setTest() { int n = 7; int[][] sets = SumToOne.getSet(n); assertThat(n).isEqualTo(sets.length); }
@Test public void setTest2() { int n = 13; int[][] sets = SumToOne.getSet(n); assertThat(n).isEqualTo(sets.length); }