Assign grades

The problem

Write a program that reads student scores, gets the best score, and then assigns grades based on the following scheme:

Grade is A if score is >= best - 10
Grade is B if score is 7= best - 20;
Grade is C if score is 7= best - 30;
Grade is D if score is 7= best - 40;
Grade is F otherwise.

The program prompts the user to enter the total number of students, then prompts the user to enter all of the scores, and concludes by displaying the grades.

Breaking it down

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    System.out.print("Enter the number of students: ");
    String numberOfStudents = input.nextLine();
    System.out.print("Enter " + numberOfStudents + " scores: ");
    String studentScores = input.nextLine();

    input.close();

    String[] studentScoresArray = studentScores.split(" ");

    OptionalInt maxValue = Stream.of(studentScoresArray)
            .mapToInt(Integer::valueOf).max();

    int maxValueAsInt = maxValue.getAsInt();

    for (int x = 0; x < studentScoresArray.length; x++) {
        System.out.println("Student "
                - x
                - " score is "
                - studentScoresArray[x]
                - " and grade is "
                - getGrade(maxValueAsInt,
                        Integer.parseInt(studentScoresArray[x])));
    }
}

public static String getGrade(int maxScore, int score) {

    if (score >= maxScore - 10) {
        return "A";
    } else if (score >= maxScore - 20) {
        return "B";
    } else if (score >= maxScore - 30) {
        return "C";
    } else if (score >= maxScore - 40) {
        return "D";
    } else {
        return "F";
    }
}

Output

Enter the number of students: 3
Enter 3 scores: 70 80 90
Student 0 score is 70 and grade is B
Student 1 score is 80 and grade is A
Student 2 score is 90 and grade is A