private void reverse(final int[] nums, int i, int j) {

        while (i < j) {
            final int tmp = nums[i];
            nums[i] = nums[j];
            nums[j] = tmp;

            i++;
            j--;
        }

    }