For this Question: Given a double linked list consisting of N nodes, your task is to reverse the linked list and return the head of the modified list.<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>Reverse()</b> that takes head node of the linked list as a parameter.


Constraints:
1 <= N <= 10^3
1<=value<=100Return the head of the modified linked list.Input:
6
1 2 3 4 5 6

Output:
6 5 4 3 2 1

Explanation:
After reversing the list, elements are as 6 <-> 5 <-> 4 <-> 3 <-> 2 <-> 1., I have written this Solution Code:   public static Node Reverse(Node head) {
           Node temp = null; 
        Node current = head; 
  
        while (current != null) { 
            temp = current.prev; 
            current.prev = current.next; 
            current.next = temp; 
            current = current.prev; 
        } 
  
        if (temp != null) { 
            head = temp.prev; 
        } 
        return head;
    }, In this Programming Language: Java, Now tell me if this Code is compilable or not?