ArrayList<Score> scores = new ArrayList<Score>();
public void addScore( String name, int value){
    Score temp  = new Score();
    temp.playerName = name;
    temp.value = value;
    scores.add(temp);
    Collections.sort(scores, new Comparator<Score>() {
        public int compare(Score o1, Score o2) {
            return (o1.value - o2.value);
        }
    });
public ArrayList<Score> getTopScores(int number){
    ArrayList<Score> topScores = new ArrayList<Score>();
    try{
        for (int i = 0; i<=number;i++){
            topScores.add(scores[i]);
            return topScores;
        }
所以基本上我试图返回一个从分数 ArrayList 中获取(数量)分数的数组。