public static ArrayList<ArrayList<Integer>>  permute(int[] num) {
		ArrayList<ArrayList<Integer>> permutation = new ArrayList<ArrayList<Integer>>();
		int n = num.length;
		if (n == 1)
			{
			ArrayList<Integer> a=new ArrayList<Integer>();
			a.add(num[0]);
			permutation.add(a);
			return permutation;
			}
		int first = num[0];
		int[] restArray = subArray(num);
		ArrayList<ArrayList<Integer>> restPer = permute(restArray);
		for (ArrayList<Integer> inter : restPer) {
			for (int i = 0; i <= inter.size(); i++) {
				permutation.add(insertDigit(inter, first, i));
			}
		}
		return permutation;
	}