public static void main( String[] args )
{
int[] a = new int[]{1,2,5,3,7,9,6};
for(int i =0 ; i < a.length;i++){
System.out.println(Arrays.toString(a));
for(int j = 0;j < a.length-i-1;j++){
if(a[j] > a[j+1]){
int temp = a[j];
a[j] = a[j+1];
a[j+1]=temp;
}
}
}
}
[1, 2, 5, 3, 7, 9, 6]
[1, 2, 3, 5, 7, 6, 9]
[1, 2, 3, 5, 6, 7, 9]
[1, 2, 3, 5, 6, 7, 9]
[1, 2, 3, 5, 6, 7, 9]
[1, 2, 3, 5, 6, 7, 9]
[1, 2, 3, 5, 6, 7, 9]