package com.yk.sort; public class Bubble { public static void bubbleSort(int[] array){ for (int i = 0; i < array.length; i++) { for (int j = 0; j < array.length - i - 1; j++) { if(array[j] > array[j + 1]){ int temp = array[j + 1]; array[j + 1] = array[j]; array[j] = temp; } } } } public static void main(String[] args) { int[] array = {5,6,4,8,9,1,10,2,3,9,3}; bubbleSort(array); for (int ii : array) System.out.print(ii + " "); } }