package TestTwo.demo4;
import java.util.Arrays;
public class BubbleSort {
public static void main(String[] args) {
int[] array = new int[]{23, 45, 43, 5, 3, 6, 6, 56, 5, 46, 4, 56, 54};
System.out.println(Arrays.toString(array));
bubbleSort(array);
System.out.println(Arrays.toString(array));
}
public static void bubbleSort(int[] array) {
int temp;
for (int i = 0; i < array.length - 1; i++) {
for (int j = 0; j < array.length - 1 - i; j++) {
if (array[j] > array[j + 1]) {
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
}
}