remove unnecessary code
add java solution for cycle_detection