/** * Checks to make sure that the input long[][] array is rectangular, * has at least 2 rows and 2 columns, and has all non-negative entries, * throwing IllegalArgumentException if any of these checks fail. * * @param in input 2-way table to check * @throws IllegalArgumentException if the array is not valid */ private void checkArray(long[][] in) throws IllegalArgumentException { if (in.length < 2) { throw new IllegalArgumentException("Input table must have at least two rows"); } if (in[0].length < 2) { throw new IllegalArgumentException("Input table must have at least two columns"); } if (!isRectangular(in)) { throw new IllegalArgumentException("Input table must be rectangular"); } if (!isNonNegative(in)) { throw new IllegalArgumentException("All entries in input 2-way table must be non-negative"); } }
if (!isNonNegative(observed1) || !isNonNegative(observed2)) { throw new IllegalArgumentException( "observed counts must be non-negative");
"observed, expected array lengths incorrect"); if (!isPositive(expected) || !isNonNegative(observed)) { throw new IllegalArgumentException( "observed counts must be non-negative and expected counts must be postive");