public class SortingArray {
public static void main(String[] args) {
int[] a={3,7,9,5,1,4,0,2,8,6};
int temp=0;
boolean isSwapped=true;
System.out.println(" before sorting the array: ");
for(int i=0;i<a.length;i++)
{
System.out.print(a[i]);
}
System.out.println("");
do
{
isSwapped=false;
for(int i=0;i<a.length-1;i++)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
}while(isSwapped);
System.out.println("after sorting the array: ");
for(int array:a)
{
System.out.print(array);
}
}
}