import java.util.Arrays;
public class SortUtil {
public static void main(String[] args) throws InterruptedException {
// new Client("127.0.0.1", 9999).start();
int[] base=new int[]{4,5,1,9,3,0,2};
base=bubbleSort(base);
Arrays.stream(base).forEach(k->System.out.print(k+","));
}
public static int[] bubbleSort(int[] base) {
int temp = 0;
boolean exchange = false;
for (int i = 0; i < base.length - 1; i++) {
for (int j = base.length-1; j > i; j--) {
if (base[j - 1] > base[j]) {
temp = base[j - 1];
base[j - 1] = base[j];
base[j] = temp;
exchange = true;
}
}
if (exchange == false) break;
}
return base;
}
}