public static boolean hasCycle(ListNode head) {
		if (head == null) {
			return false;
		}
		ListNode pointer1 = head;
		ListNode pointer2 = head;
		while (pointer1 != null && pointer2 != null) {
			pointer1 = pointer1.next;
			if (pointer2.next != null) {
				pointer2 = pointer2.next.next;
			} else {
				return false;
			}
			if (pointer1 == pointer2) {
				return true;
			}
		}
		return false;
	}