public static double Evaluate(double[] v){if (v.Length < 2){throw new EvaluationException(ErrorEval.NA);}int[] counts = new int[v.Length];Arrays.Fill(counts, 1);for (int i = 0, iSize = v.Length; i < iSize; i++){for (int j = i + 1, jSize = v.Length; j < jSize; j++){if (v[i] == v[j])counts[i]++;}}double maxv = 0;int maxc = 0;for (int i = 0, iSize = counts.Length; i < iSize; i++){if (counts[i] > maxc){maxv = v[i];maxc = counts[i];}}if (maxc > 1){return maxv;}throw new EvaluationException(ErrorEval.NA);}