public void nextPermutation(int[] num) {
		int n = num.length;
		if (n == 0 || n == 1)
			return;
		int index = n - 1;
		while (index > 0) {
			if (num[index] > num[index - 1]) {
				break;
			}
			index--;
		}
		if (index == 0) {
			reverse(num, 0, n - 1);
			return;
		} else {
			int left = index - 1;
			while (index < n && num[index] > num[left]) {
				index++;
			}
			int right = index - 1;
			exchange(num, left, right);
			reverse(num, left + 1, n - 1);
		}
	}