Bubble sort in java , method (static or non staic)? ,(void or int[] )?,instance variable needed? : <p>Can someone explain for me when do I use static /non-static 
, void or int[]x , and when do I use instance variables </p>

<p>because I can't seem to figure out which is when resulting in errors like this in the bubble sort code</p>

<pre><code>public class PA2 {
//int []a ;
//int maxsize ;
//int temp;
public static int[] bubblesort(int [] a1) {
    int temp ;
    for(int i=0;i&lt;a.length-1;i++) {
        for(int j=0 ; j&lt;a.length-1-i;j++) {
        if(a[i]&gt;a[i+1])
       temp = a[i];
        a[i]=a[i+1];
        a[i+1]=temp;
        }   
    }
}
public static void main(String[] args) {
    int [] a1 = {11,5,14,10,2};
     bubblesort(a1);
    //a.bubblesort();
   //a.selectionsort();
   // a.insertionsort();     }      }
</code></pre>
