public void saveScores() throws java.io.IOException {
	
        int size = this.size();
	
        //sort currente arraylist in decreasing order
        Collections.sort(this);
        Collections.reverse(this);

        try {
            //check if the file exists, if not, create one
            File file = new File("data/HighScores");
            if (!file.exists()) {
                file.createNewFile();
            }

            FileWriter fw = new FileWriter(file.getAbsoluteFile());
            BufferedWriter bw = new BufferedWriter(fw);

            //write scores to the file line by line
            for (int i=0; i<10 && i<size; i++) {
                Score score = this.get(i);
                if (score.score != 0) {
                    String content = score.toString() + System.lineSeparator();
                    bw.write(content);
                }
            }

            bw.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }