Hi I have just started to read up on java and have tried to construct some exampel tasks. But I am struggeling with this one.

Find the SECOND biggest number in an array.

I understand how to find the smallest number like this:

int smallest = ar[0]; for(i=0; i < ar.lenght; i++){ if (ar[i] < smallest){ smallest=ar[i] } }

But how do I find the second smallest number?