Making an array out of doubles from a text file

I need to read a file of grades and input them into an array. I cant seem to figure it out though. Any suggestions. Thanks for your help 🙂
The grades.txt file looks like this:

90.0
71.5
87.9
95.0
98.1

Code:

File file1 = new File("grades.txt");
Scanner gradesFile = new Scanner(file1);
String line = gradesFile.nextLine();

//create array
double[] array = new double[12];

//variable to increment
int u = 0;

//loop to put data into array
while(gradesFile.hasNextDouble())

    array[u] = gradesFile.nextDouble();
    u += 1;

gradesFile.close();