public static void UF10(double[] x,double[] f,int nx){
  int count1=0;
  int count2=0;
  int count3=0;
  double sum1=0.0;
  double sum2=0.0;
  double sum3=0.0;
  double yj;
  double hj;
  for (int j=3; j <= nx; j++) {
    yj=x[j - 1] - 2.0 * x[1] * Math.sin(2.0 * PI * x[0] + j * PI / nx);
    hj=4.0 * yj * yj - Math.cos(8.0 * PI * yj) + 1.0;
    if (j % 3 == 1) {
      sum1+=hj;
      count1++;
    }
 else     if (j % 3 == 2) {
      sum2+=hj;
      count2++;
    }
 else {
      sum3+=hj;
      count3++;
    }
  }
  f[0]=Math.cos(0.5 * PI * x[0]) * Math.cos(0.5 * PI * x[1]) + 2.0 * sum1 / (double)count1;
  f[1]=Math.cos(0.5 * PI * x[0]) * Math.sin(0.5 * PI * x[1]) + 2.0 * sum2 / (double)count2;
  f[2]=Math.sin(0.5 * PI * x[0]) + 2.0 * sum3 / (double)count3;
}

public static void UF10 ( double [ ] x , double [ ] f , int nx ) { int count1 = 0 ; int count2 = 0 ; int count3 = 0 ; double sum1 = 0.0 ; double sum2 = 0.0 ; double sum3 = 0.0 ; double yj ; double hj ; for ( int j = 3 ; j <= nx ; j ++ ) { yj = x [ j - 1 ] - 2.0 * x [ 1 ] * Math . sin ( 2.0 * PI * x [ 0 ] + j * PI / nx ) ; hj = 4.0 * yj * yj - Math . cos ( 8.0 * PI * yj ) + 1.0 ; if ( j % 3 == 1 ) { sum1 += hj ; count1 ++ ; } else if ( j % 3 == 2 ) { sum2 += hj ; count2 ++ ; } else { sum3 += hj ; count3 ++ ; } } f [ 0 ] = Math . cos ( 0.5 * PI * x [ 0 ] ) * Math . cos ( 0.5 * PI * x [ 1 ] ) + 2.0 * sum1 / ( double ) count1 ; f [ 1 ] = Math . cos ( 0.5 * PI * x [ 0 ] ) * Math . sin ( 0.5 * PI * x [ 1 ] ) + 2.0 * sum2 / ( double ) count2 ; f [ 2 ] = Math . sin ( 0.5 * PI * x [ 0 ] ) + 2.0 * sum3 / ( double ) count3 ; }
evaluates the uf10 problem .
