sorted array in java using swap methods
<p>My problem is when I sort a list it will get the last element of the array wrong, ending up with it at the beginning of the array. In my example it fails to sort the last element which is 9, ending up printed first ahead of small numbers such as 0 and 1. Here is my code:</p>

<pre><code>public class ty {
public static void main(String[]argus){
    int []numbers={45,23,34,545,56,23,4,1,66,0,9};  
    int j;
        for( int i=0;i&lt;numbers.length;i+=1){
            int first=0;
            for(j=0;j&lt;=i;j+=1){
                if(numbers[j]&gt;=first){
                    first=numbers[j];
                    numbers[j]=numbers[i];
                    numbers[i]=first;}
            }//inner loop
        }//first loop
        for(int i=0;i&lt;numbers.length;i+=1){
            System.out.print(numbers[i]+" ");}  
}
}
</code></pre>

<blockquote>
  <p><strong>//the output is    9 0 1 4 23 23 34 45 56 66 545</strong></p>
</blockquote>

<p>As you see, they are in order except for the 9 at the start which is out of place.</p>