private boolean checkForNaNs(NumberVector vec){
  for (int i=0, d=vec.getDimensionality(); i < d; i++) {
    double v=vec.doubleValue(i);
    if (v != v) {
      return true;
    }
  }
  return false;
}

private boolean checkForNaNs ( NumberVector vec ) { for ( int i = 0 , d = vec . getDimensionality ( ) ; i < d ; i ++ ) { double v = vec . doubleValue ( i ) ; if ( v != v ) { return true ; } } return false ; }
check for nan values .
