import java.io.*; import java.util.*; class Bubble { public int n; public int[] A; /* ----------------------------------------------------------------- Constructor defined ----------------------------------------------------------------- */ public Bubble(int MAX) { A=new int[MAX]; } /* ---------------------------------------------------------------------------------- bubblesort : function for sorting the elements ---------------------------------------------------------------------------------- */ public void bubblesort(int n) { int temp; for(int i=0; i<=n-2; i++) { for(int j=0; j<=n-2-i; j++) { if(A[j]>A[j+1]) { temp=A[j]; A[j]=A[j+1]; A[j+1]=temp; }//end of if }//end of inner for }//end of outer for }//end of function /* ---------------------------------------------------------------------------------- display: function for displaying the elements ---------------------------------------------------------------------------------- */ public void display(int n) { System.out.println("\n The sorted List is ...\n"); for(int i=0; i