//快排
public static void quickSort(int[] arr, int l, int r) {
if (l < r) {
swap(arr, l + (int) (Math.random() * (r - l + 1)), r);
int[] p = partition(arr, l, r);
quickSort(arr, l, p[0]);
quickSort(arr, p[1], r);
}
}
public static int[] partition(int[] arr, int l, int r) {
int less = l - 1;
int more = r + 1;
int current = less + 1;
int num = arr[r];
while (current < more) {
if (arr[current] < num) {
swap(arr, ++less, current++);
} else if (arr[current] > num) {
swap(arr, --more, current);
} else {
current++;
}
}
return new int[]{less, more};
}