Java: Sorting unsorted array in descending order
<p>I have an unsorted array of objects.  I need to know how I can sort my array in descending order, according to the highest value inside the objects.</p>

<p>I need to do this using for loops, not the easy way.</p>

<p>I had done this but it seems there is a problem:</p>

<pre><code>student[] temp=new student[s.length];

for (int i=0;i&lt;s.length;i++)
{
    if (s[i].GetGpa() &gt; s[i + 1].GetGpa())
    {
        temp[i] = s[i];
    }
}
</code></pre>

<p>How should I do it using for loops?</p>
