public class Bubble { public static final int a[] = {3,2,5,6,8,10,4,7,9,1}; public static final int length = a.length; public static void main(String[] args) { for(int i = 1 ; i < length ; i++){ for(int j = 0; j < length-i ; j++){ int temp; if(a[j+1]>a[j]){ temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; } } } for(int i = 0 ; i <length ; i++){ System.out.print(a[i]+" "); } } }