Bubble sort
public class Main {
public static void main(String[] args) {
int [] arr = {9,8,7,6,5,4,3,2,1,0};
bubbleSort(arr);
for(int i:arr)
System.out.println(i);
}
private static void bubbleSort(int [] arr){
for (int i = arr.length - 1 ; i > 0 ; i --)
{
for (int j = 0 ; j < i ; j ++)
{
if (arr[j]> arr[j+1])
{
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp ;
}
}
}
}
}