1public ListNode middleNode(ListNode head) { 2 ListNode slow = head; 3 ListNode fast = head; 4 5 while (fast != null && fast.next != null) { 6 slow = slow.next; 7 fast = fast.next.next; 8 } 9 10 return slow; 11}