You may also use the Collections and Arrays class in-collaboration to get the maximum or the minimum value of an array. The code will be something like:
Collections.max(Arrays.asList(n));
On the other hand to get the minimum value of an array the code will be:
Collections.min(Arrays.asList(n));