Both are legal and both work. But placing [] before the array’s name is recommended.
From Javadocs:
You can also place the square brackets after the array’s name:
float anArrayOfFloats[]; // this form is discouraged
However, convention discourages this form; the brackets identify the array type and should appear with the type designation.