public class BubbleSort {
public static void main(String[] args) {
BubbleSort bs = new BubbleSort();
bs.bubbleSort();
}
public void bubbleSort() {
int[] str= {5,9,6,8,0,5,3,4};
// for(int i=0;i<str.length-1;i++) {
// for(int j=str.length-1;j>i;j--) {
// if(str[j-1]>str[j]) {
// int temp=str[j-1];
// str[j-1]=str[j];
// str[j]=temp;
// }
// }
// }
for(int i = 1;i<str.length;i++) {
for(int j = 0;j<str.length-i;j++) {
if(str[j]>str[j+1]) {
int temp=str[j];
str[j]=str[j+1];
str[j+1]=temp;
}
}
}
for(int i=0;i<=str.length-1;i++) {
System.out.println(str[i]);
}
}
}