title: BubbleSort using integer Array
body: <p>I have been trying to implement Bubble Sort using simple integer array in java. However there seems to be some problem. Now i know that using ArrayList would be the best option and I would do that too. But why isnt it getting sorted with simple integer array.Here is the code</p>
  
  <pre><code>package sort;
  
  public class BubbleSort {
  
      int array[]={1,5,3,32,54,6,87,5,1};
      int temp=0;
  public void enter(){
      for(int i=0;i&lt;array.length;i++){
          for(int j=0;j&lt;(array.length-i);j++){
              if(array[j]&gt;=array[j+1]){
  
  
                  temp=array[j];
                  array[j]=array[j+1];
                  array[j+1]=temp;
                  }
  
          }
      }
  }
  public void show(){
  
      for(int i:array){
      System.out.println(i);
      }
  }
  public static void main(String str[]){
  
      new BubbleSort().Enter();
      new BubbleSort().Show();
  }
  }
  </code></pre>
  
  <p>Its producing the same array as entered. Nothing is getting changed. The difference between a simple array and an ArrayList or Vector ,is just that they offer dynamic time expansion of array size.Is there anything more to it? I mean does simple array creates a different instance every time it is manipulated, just like Strings? It does seem to do so here.</p>