static public double griewank(double[] x) {

    double sum = 0.0;
    double product = 1.0;

    for (int i = 0; i < x.length; i++) {
      sum += ((x[i] * x[i]) / 4000.0);
      product *= Math.cos(x[i] / m_iSqrt[i]);
    }

    return (sum - product + 1.0);
  }
static public double griewank ( double [ ] x ) { double sum = 0.0 ; double product = 1.0 ; for ( int i = 0 ; i < x . length ; i ++ ) { sum += ( ( x [ i ] * x [ i ] ) / 4000.0 ) ; product *= Math . cos ( x [ i ] / m_iSqrt [ i ] ) ; } return ( sum - product + 1.0 ) ; }
Griewank's function