Sorting highscore by time and number of guesses
<p>As of now my highscore list is only sorted by number of guesses. I would like entries with identical number of guesses to also be sorted by time in ms, in descending order. Tried searching and found some similar Q's but couldn't really find a solution. Any pointers will be greatly appreciated! Feel free to comment on other parts of my code as well!</p>

<pre><code>import java.util.*;

public class Game {

private static ArrayList&lt;highScore&gt; score = new ArrayList&lt;highScore&gt;();

private class highScore implements Comparable&lt;highScore&gt; {

    int guessCount = 0;
    double playerTime = 0;
    String playerName;

    public highScore (int guessCount, double playerTime, String playerName) {
        this.guessCount = guessCount;
        this.playerTime = playerTime;
        this.playerName = playerName;
    }

    public String toString() {
        String scoreList = (this.playerName + "\t\t" + this.guessCount + "\t\t" + this.playerTime);
        return scoreList;
    }

    public int compareTo(highScore hs) {
        if (((Integer)this.guessCount).compareTo(((Integer)hs.guessCount)) &gt; 0)
            return 1;
        else
            return -1;
    }
}

public static void main(String [] args) {

    boolean playGame = true;
    Scanner scan = new Scanner(System.in);

    Game g = new Game();

    while(playGame) {
        g.start();

        System.out.println("\nPlay again?");
        String s = scan.nextLine();
            if (s.equalsIgnoreCase("n")) {
                System.out.print("Quitting...");
                playGame = false;
        }
    }
}

public void start() {

    int number = (int) (Math.random() * 1001 );
    int guess = -1;
    int guessCount = 0;
    String guessStr, playerName;
    String quit = "quit";
    Scanner scan = new Scanner(System.in);
    boolean play = true;

        System.out.print("Welcome to the greatest guessing game of all time!" + 
        "\nGuess a number between 1-1000!" + 
        "\nType \"quit\" to quit.");

        long startTime = System.currentTimeMillis();

        System.out.println("\nDEBUG, nr is: " + number);

        while (guess != number &amp;&amp; play) {
            try {
                System.out.print("\nEnter your guess: ");
                guessStr = scan.nextLine();
                    if (guessStr.equalsIgnoreCase("quit")) {
                        play = false;
                        System.out.println("Quitting...");
                        return;
                }
                guess = Integer.parseInt(guessStr);

                if (guess &lt;= 1 || guess &gt; 1000) {
                    System.out.println("Invalid guess, won't count, try again!");
                }
                if (guess &lt; number) {
                    System.out.println("Too low, try again!");
                    guessCount++;
                }
                if (guess &gt; number) {
                    System.out.println("Too high, try again!");
                    guessCount++;
                }
            }
            catch(NumberFormatException e) {
                System.out.println("Sorry, only numbers. Try again!");
            }
            catch (InputMismatchException ex) {             
                System.out.println("Sorry, only numbers. Try again!");
            }
        }

        if (guess == number) {
            long endTime = System.currentTimeMillis();
            long gameTime = endTime - startTime;

            System.out.println("Nice, the correct number is " + number + "!");
            System.out.print("You nailed it after " + (int)(gameTime)/1000 + " seconds and " + guessCount + " tries!");
            System.out.println("\nEnter your name!");

            playerName = scan.nextLine();
            score.add(new highScore(guessCount, gameTime, playerName));
            Collections.sort(score);

            System.out.println("Name ------- Guesses -------- Time in ms");
            for (highScore h: score) {
                System.out.println(h);
            }
        }
     }
 }
</code></pre>
