//Bubble sort Algorithm
// Java program for implementation of BubbleSort
class BubbleSort
{
/* Fuction Implementing Bubble Sort Algorithm */
void sort(int arr[])
{
int swapped;
int length = arr.length;
for(int i=0; iarr[j+1])
{
int temp=arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;
swapped=1;
}
}
if(swapped==0)
break;
}
}
/* A utility function to print array of size n */
static void printArray(int arr[])
{
int n = arr.length;
for (int i=0; i