code: static public double EScafferF6(double[] x) {
  
      double sum = 0.0;
  
      for (int i = 1; i < x.length; i++) {
        sum += ScafferF6(x[i - 1], x[i]);
      }
      sum += ScafferF6(x[x.length - 1], x[0]);
  
      return (sum);
    }
docs: Expanded Scaffer's F6 function