public static void CF2(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=2.0;
  double a=1.0;
  double t;
  for (int j=2; j <= nx; j++) {
    yj=x[j - 1] - Math.sin(6.0 * PI * x[0] + j * PI / nx);
    if (j % 2 == 1) {
      yj=x[j - 1] - Math.sin(6.0 * PI * x[0] + j * PI / nx);
      sum1+=yj * yj;
      count1++;
    }
 else {
      yj=x[j - 1] - Math.cos(6.0 * PI * x[0] + j * PI / nx);
      sum2+=yj * yj;
      count2++;
    }
  }
  f[0]=x[0] + 2.0 * sum1 / (double)count1;
  f[1]=1.0 - Math.sqrt(x[0]) + 2.0 * sum2 / (double)count2;
  t=f[1] + Math.sqrt(f[0]) - a * Math.sin(N * PI * (Math.sqrt(f[0]) - f[1] + 1.0)) - 1.0;
  c[0]=MYSIGN(t) * Math.abs(t) / (1 + Math.exp(4.0 * Math.abs(t)));
}

public static void CF2 ( 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 = 2.0 ; double a = 1.0 ; double t ; for ( int j = 2 ; j <= nx ; j ++ ) { yj = x [ j - 1 ] - Math . sin ( 6.0 * PI * x [ 0 ] + j * PI / nx ) ; if ( j % 2 == 1 ) { yj = x [ j - 1 ] - Math . sin ( 6.0 * PI * x [ 0 ] + j * PI / nx ) ; sum1 += yj * yj ; count1 ++ ; } else { yj = x [ j - 1 ] - Math . cos ( 6.0 * PI * x [ 0 ] + j * PI / nx ) ; sum2 += yj * yj ; count2 ++ ; } } f [ 0 ] = x [ 0 ] + 2.0 * sum1 / ( double ) count1 ; f [ 1 ] = 1.0 - Math . sqrt ( x [ 0 ] ) + 2.0 * sum2 / ( double ) count2 ; t = f [ 1 ] + Math . sqrt ( f [ 0 ] ) - a * Math . sin ( N * PI * ( Math . sqrt ( f [ 0 ] ) - f [ 1 ] + 1.0 ) ) - 1.0 ; c [ 0 ] = MYSIGN ( t ) * Math . abs ( t ) / ( 1 + Math . exp ( 4.0 * Math . abs ( t ) ) ) ; }
evaluates the cf2 problem .
