This is the way I would go about getting the second highest number:
// The array containing number.
int[] number = {1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10};
// The int[] is copied to Integer[] array. This is done because the Arrays class cannot sort primitives (such as int). If any other primitive type, they can be converted to their respective objects.
Integer[] numberInteger = new Integer[number.length];
// Populate the Integer[] with data from int[].
for(int i = 0; i<number.length; i++)
{
numberInteger[i] = number[i];
}
// Sort the Integer[] array in reverse order.
Arrays.sort(numberInteger, Collections.<Integer>reverseOrder());
// Print the result out.
System.out.println("The second highest number is: "+numberInteger[1]);
// Output is~~~~~~~ The second highest number is: 9
If you have other primitive type (e.g. double[]) it can be copied to it's respective object (e.g Double[]).
P.S. If using Java 8, Integer[] array can be populated in an easier way. Streams can be used to populate Integer[].
// Instead of using a for loop, Streams are used.
Integer[] numberInteger = Arrays.stream(number).boxed().toArray(Integer[]::new);