/** Attempt to add a new score to the collection (if it is high enough) */
public void add(GameEntry e) {
int newScore = e.getScore();
// is the new entry e really a high score?
if (numEntries == maxEntries) { // the array is full
if (newScore <= entries[numEntries-1].getScore())
return; // the new entry, e, is not a high score in this case
}
else // the array is not full
numEntries++;
// Locate the place that the new (high score) entry e belongs
int i = numEntries-1;
for ( ; (i >= 1) && (newScore > entries[i-1].getScore()); i--)
entries[i] = entries[i - 1]; // move entry i one to the right
entries[i] = e; // add the new score to entries
}