Finding the second largest value In an Array findSecondLargestNumberInTheArray() method returns the second highest number from an array.

Could you please review this code to enhance performance.

public static int findSecondLargestNumberInTheArray(int array[]) {
    // Initialize these to the smallest value possible
    int highest = Integer.MIN_VALUE;
    int secondHighest = Integer.MIN_VALUE;

    // Loop over the array
    for (int i = 0; i &lt; array.length; i++) {

        // If current element is greater than highest
        if (array[i] &gt; highest) {

            // assign second highest element to highest element
            secondHighest = highest;

            // highest element to current element
            highest = array[i];
        } else if (array[i] &gt; secondHighest)
            // Just replace the second highest
            secondHighest = array[i];
    }

    // After exiting the loop, secondHighest now represents the second
    // largest value in the array
    return secondHighest;
}
Several comments are unnecessary:

    // Loop over the array
    for (int i = 0; i &lt; array.length; i++) {

    // assign second highest element to highest element
    secondHighest = highest;


I recommend do use braces { ... } for all if-blocks, even if that
consists only of a single statement, and definitely if there is
an additional comment line:

        } else if (array[i] &gt; secondHighest)
            // Just replace the second highest
            secondHighest = array[i];


Iteration over all array elements can be simplified with an
“enhanced for loop:”

    for (int elem : array) {
        // ...
    }


Your function returns Integer.MIN_VALUE for an empty or single-element
array, which is fine if specified as such. An alternative would be
to throw an exception for arrays with less than two elements.

With respect to performance, I doubt there is much to improve.
The function iterates once over all array elements, which looks pretty
much optimal.