public String getPermutation(int n, int k) {
        ArrayList<Integer> nums = new ArrayList<Integer>();
        int index = 0, permutation = 1;
        boolean flag = false;
        for (int i = 1; i <= n; ++i) {
            nums.add(i);
            permutation *= i;
        }
        --k;
        String result = "";
        for (int i = 0; i < n; ++i) {
            permutation = permutation / (n - i);
            int choosed = k / permutation;
            System.out.println(choosed);
            result += String.valueOf(nums.get(choosed));
            nums.remove(choosed);
            k = k % permutation;
        }
        return result;
    }