For this Question: Given the heads of two singly linked lists head1 and head2, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null

For example, the following two linked lists begin to intersect at node c1<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>intersection()</b> that takes the head node of both lists as a parameter.

The first line of the test case contains: 
<ul>
<li>the size of the 1st linked list</li> 
<li>size of 2nd linked list</li>
<li>the size of the common part of two linked lists</li>
</ul>

The rest of the test case contains:
<ul>
<li>elements of 1st linked list</li>
<li>elements of 2nd linked list</li>
<li>common part of two linked lists</li>
</ul>Return the node of intersectionSample Input:-
4 3 4
1 2 3 4
5 6 7
9 10 11 12


Sample Output:-
9

Explanation:
&nbsp;1 -> 2 -> 3 -> 4
                          &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;|
&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;9 -> 10 -> 11 -> 12
                          &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;|
&ensp;&nbsp;&nbsp;&nbsp; 5 -> 6 -> 7, I have written this Solution Code: 
public static Node intersection(Node head1,Node head2){  int aLength = getLength(head1), bLength = getLength(head2);
        Node currA = head1, currB = head2;
        if (bLength > aLength) 
            for (int i = 0; i < bLength - aLength; i++) currB = currB.next;
        
        if (aLength > bLength) 
            for (int i = 0; i < aLength - bLength; i++) currA = currA.next;
        
        while (currA != null  && currB != null) {
            if (currA == currB) return currA;
            currA = currA.next;
            currB = currB.next;
        }
        
        return null;
    }
    
    private static int getLength(Node head) {
        Node curr = head;
        int len = 0;
        while (curr != null) {
            curr = curr.next;
            len++;
        }
        return len;
    }
, In this Programming Language: Java, Now tell me if this Code is compilable or not?