public void wiggleSort(int[] nums) {
        if (nums == null) return;

        int n = nums.length;
        int[] tmp = new int[n];
        for (int i = 0; i < n; ++i) tmp[i] = nums[i];
        Arrays.sort(tmp);
        int low = (n - 1) / 2, high = n - 1;
        for (int i = 0; i < n; ++i) nums[i] = tmp[(i & 1) == 0 ? low-- : high--];
    }