private static void detectFirstCycle(ArrayList<Integer> numSeq){
		int length = numSeq.size();
		ArrayList<Integer> subSeq = new ArrayList<Integer>();
		subSeq.add(numSeq.get(0));
		int size = 1;
		for(int i = 1; i<length; i++){
			for(int j=0; j<size; j++){
				if(subSeq.get(j)==numSeq.get(i)){
					int k = j;
					int g = i;
					while(k<size){
						if(subSeq.get(k)!=numSeq.get(g))
							break;
						k++;
						g++;
					}
					if(k==size){
						System.out.print("" + numSeq.get(i));
						for(int m=i+1; m<(i+size-j); m++){
							System.out.print(" " + numSeq.get(m));
						}
						System.out.println();
						return;
					}	
				}
			}
			subSeq.add(numSeq.get(i));
			size++;
		}
		System.out.println("No cycles detected.");
	}