public int[][] PermToCycleDecomp(int[] perm){
		int[][] Cycle = NewCycleDecomp(perm.length);
		boolean[] LookedAt = SetUpArray(perm.length);
		int FirstEntry = 1;//indicates where the cycle starts
		int LastEntry = 1;//indicates the last entry from the cycle
		int CycleNumber = 0; //indicates which cycle the method is on
		int CycleIndex = 1; //index of next entry in the cycle
		int Index = 1; //index of where to start inspecting for cycles
		while(Finished(LookedAt) == false){
			while(Index <= n){//finds out where the next cycle starts
				if(perm[Index] != Index && LookedAt[Index] == false){
					Cycle[CycleNumber][0] = Index;
					FirstEntry = Index;
					LastEntry = perm[Index];
					LookedAt[Index] = true;
					break;
				}
				LookedAt[Index] = true;
				Index++;
			}
			while(LastEntry != FirstEntry){//does a loop to get the cycle
				LookedAt[LastEntry] = true;
				Cycle[CycleNumber][CycleIndex] = LastEntry;
				LastEntry = perm[LastEntry];
				CycleIndex++;
			}
			CycleIndex = 1;
			CycleNumber++;
		}
		return Cycle;
	}