public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Random rand = new Random();
        // The default ranges
        int[][] ranges = {{0,10}, {0,100}, {0,500}, {0,1000}};
        try {
            do {
                int[] range = getRange(scan, ranges);
                int min = range[0], max = range[1];
                int secret = randomRange(rand, min, max);
                boolean success = false;
                int guesses = minimumGuesses(min, max);

                System.out.println("You have " + guesses + " guess(es) to guess the secret number.");
                do {
                    if (guesses == 0) {
                        System.out.print("You ran out of guesses. The secret number was " + secret + ". ");
                        break;
                    }
                    int guess = getGuess(scan, min, max);
                    guesses--;
                    if (guess == secret) {
                        System.out.print("CORRECT! You guessed the secret number. ");
                        success = true;
                    } else if (guess < secret) {
                        System.out.println("Your guess is too low, please try again. " + 
                                "You have " + guesses + " guess(es) left.");
                    } else if (guess > secret) {
                        System.out.println("Your guess is too high, please try again. " + 
                                "You have " + guesses + " guess(es) left.");
                    } else {
                        System.out.println("You broke my program, impressive...");
                    }
                } while (!success);
            } while (keepPlaying(scan));
            System.out.println("Good-bye!");
        } finally {
            scan.close();
        }
    }