Guess the number game I just started to learn Java and had to write a "guess the number" game. 

Could you please review and give me some feedback?

public static void main(String[] args) {

    System.out.println("Welcome to the guess the number game!\n");
    System.out.println("Please specify the configuration of the game:\n");

    Scanner input = new Scanner(System.in);

    System.out.println("Range start number (inclusively):");
    int startRange;
    startRange = nextValidInt(input);

    System.out.println("Range end (inclusively):");
    int endRange;
    endRange = nextValidInt(input);

    System.out.println("Maximum number of attemps:");
    int maxAttemp;
    maxAttemp = nextValidInt(input);

    System.out.println("Your Task is to guess the random number between "
            + startRange + " and " + endRange);

    Random randGenerator = new Random();
    int randNumber = randGenerator.nextInt((endRange - startRange + 1)
            + startRange);
    int numberOfTries = 0;

    System.out
            .println("You may exit the game by typing; exit - you may now start to guess:");

    for (numberOfTries = 0; numberOfTries &lt;= maxAttemp - 1; numberOfTries++) {

        int guess;
        guess = nextValidInt(input);

        if (guess == randNumber) {
            System.out.println("Congratz - you have made it!!");
            System.out.println("Goodbye");
            break;
        } else if (guess &gt; randNumber) {
            System.out.println("The number is smaller");
        } else if (guess &lt; randNumber) {
            System.out.println("The number is higher");
        }

    }

    if (numberOfTries &gt;= maxAttemp) {
        System.out.println("You reached the max Number of attempts :-/");
    }

}

public static int nextValidInt(Scanner s) {
    while (!s.hasNextInt() &amp;&amp; s.hasNext()) {
        System.out.println("Please provide a valid integer value!");
        s.next();
    }
    return s.nextInt();

}
Not a full review, just a couple of points that jumped out at me:


you often assign the value to a variable on the next line after declaring it. Just assign the value on the same line (eg int startRange = nextValidInt(input);).
you can declare a loop variable inside the loop: for (int numberOfTries = 0; numberOfTries &lt;= maxAttemp - 1; numberOfTries++).
if (numberOfTries &gt;= maxAttemp) will always be true, as the for loop increases numberOfTries to maxAttemp. Well, except when you won. I would remove the if and replace the break with a return.
numberOfTries &lt;= maxAttemp - 1 looks better written as numberOfTries &lt; maxAttemp.
the main method shouldn't do anything except start your program. I would move your code to its own function. You might also want to create extra functions for initial info printing/setup gathering and the actual guessing game.