class BubbleSort {
public static void main (String[] args) {
int[] arr = {5, 11, 44, 56, 66, 3, 6, 2, 7, 4, 10, 12, 444, 543, 234, 2342, 45435, 234, 3454, 234, 2342, 567, 7684, 234, 23454, 2342};
printArray(arr);
Arrays.sort(arr);
System.out.println("-------------");
printArray(arr);
}
public static void printArray(int[] arr) {
System.out.print("[");
for (int x = 0; x < arr.length; x++) {
if (x == arr.length - 1) {
System.out.print(arr[x] + "]");
System.out.println();
}
else {
System.out.print(arr[x] + ",");
}
}
}
} |
|