protected static int[] arrayRemove(int[] a, int b) { if (Sonet.arrayContains(a, b)) { int[] c = new int[a.length - 1]; int i = 0; for (int d : a) { if (d != b) { c[i++] = d; } } return c; } else { return a; } }
protected static int[] arrayAdd(int[] a, int b) { if (!Sonet.arrayContains(a, b)) { int cLen = a.length; int[] c = new int[cLen]; for (int i = 0; i < cLen; i++) { c[i] = a[i]; } a = new int[cLen + 1]; for (int i = 0; i < cLen; i++) { a[i] = c[i]; } a[cLen] = b; } return a; }