public static void CF1(double[] x,double[] f,double[] c,int nx){
  int count1=0;
  int count2=0;
  double sum1=0.0;
  double sum2=0.0;
  double yj;
  double N=10.0;
  double a=1.0;
  for (int j=2; j <= nx; j++) {
    yj=x[j - 1] - Math.pow(x[0],0.5 * (1.0 + 3.0 * (j - 2.0) / (nx - 2.0)));
    if (j % 2 == 1) {
      sum1+=yj * yj;
      count1++;
    }
 else {
      sum2+=yj * yj;
      count2++;
    }
  }
  f[0]=x[0] + 2.0 * sum1 / (double)count1;
  f[1]=1.0 - x[0] + 2.0 * sum2 / (double)count2;
  c[0]=f[1] + f[0] - a * Math.abs(Math.sin(N * PI * (f[0] - f[1] + 1.0))) - 1.0;
}

public static void CF1 ( double [ ] x , double [ ] f , double [ ] c , int nx ) { int count1 = 0 ; int count2 = 0 ; double sum1 = 0.0 ; double sum2 = 0.0 ; double yj ; double N = 10.0 ; double a = 1.0 ; for ( int j = 2 ; j <= nx ; j ++ ) { yj = x [ j - 1 ] - Math . pow ( x [ 0 ] , 0.5 * ( 1.0 + 3.0 * ( j - 2.0 ) / ( nx - 2.0 ) ) ) ; if ( j % 2 == 1 ) { sum1 += yj * yj ; count1 ++ ; } else { sum2 += yj * yj ; count2 ++ ; } } f [ 0 ] = x [ 0 ] + 2.0 * sum1 / ( double ) count1 ; f [ 1 ] = 1.0 - x [ 0 ] + 2.0 * sum2 / ( double ) count2 ; c [ 0 ] = f [ 1 ] + f [ 0 ] - a * Math . abs ( Math . sin ( N * PI * ( f [ 0 ] - f [ 1 ] + 1.0 ) ) ) - 1.0 ; }
evaluates the cf1 problem .
