code: private int computePk1Measure(double[] objectiveScores,
                                    double pk1Threshold) {
          LOGGER.fine("Computing the PK1 measure");
  
          // Compute the average of the objective scores.
          double average = 0;
          for (int k = 0; k < objectiveScores.length; ++k)
              average += objectiveScores[k];
          average /= objectiveScores.length;
  
          // Compute the standard deviation of the objective scores.
          double stdev = 0;
          for (int k = 0; k < objectiveScores.length; ++k)
              stdev += Math.pow(objectiveScores[k], 2);
          stdev /= objectiveScores.length;
          stdev = Math.sqrt(stdev);
  
          // Find the smallest k such that the pk1 score surpasses the threshold.
          for (int k = 0; k < objectiveScores.length; ++k) {
              objectiveScores[k] = (objectiveScores[k] - average) / stdev;
              if (objectiveScores[k] > pk1Threshold)
                  return k;
          }
  
          return 0;
      }
docs: Compute the smallest k that satisfies the Pk1 method.