Updated CycleDetection.java