Simplify.
Thanks to Alex Herbert.
@@ -581,13 +581,10 @@ public final class MathArrays {
* @throws NotFiniteNumberException if any values of the array is not a
* finite real number.
*/
- public static void checkFinite(final double[] val)
- throws NotFiniteNumberException {
- for (int i = 0; i < val.length; i++) {
- final double x = val[i];
- if (Double.isInfinite(x) ||
- Double.isNaN(x)) {
- throw new NotFiniteNumberException(val[i]);
+ public static void checkFinite(final double[] val) {
+ for (double x : val) {
+ if (!Double.isFinite(x)) {
+ throw new NotFiniteNumberException(x);
}
}
}
