public static void checkValid(double[] x){
  for (  double v : x) {
    if (Double.isNaN(v)) {
      throw new RuntimeException("Invalid entry " + v);
    }
  }
}

public static void checkValid ( double [ ] x ) { for ( double v : x ) { if ( Double . isNaN ( v ) ) { throw new RuntimeException ( "Invalid entry " + v ) ; } } }
loop and ensure all elements are non - infiite and non - nan , throws an exception if one is
