A simple proof-of-concept to better understand how to calculate percentiles.
public class PercentileTest
{
public static void main(final String[] args)
{
final int[] scores = { 40, 50, 50, 66, 67, 67, 68, 69, 73, 75, 79, 79,
81, 82, 82, 88, 89, 93, 93, 93, 99, 100
};
int outerCounter = 0;
int repeatingCounter = 0;
int lastScore = -1;
for (final int s : scores) {
if (s != lastScore) {
outerCounter = outerCounter + 1 + repeatingCounter;
repeatingCounter = 0;
} else {
repeatingCounter = repeatingCounter + 1;
}
final float percentile = (float) outerCounter / scores.length * 100;
System.out.println("Score: " + s + "\tPercentile: " + percentile);
lastScore = s;
}
}
}