For this Question: Given a Binary Tree, your task is to convert it to a Doubly Linked List. The left and right pointers in nodes are to be used as previous and next pointers respectively in converted Double linked list. The order of nodes in Double linked list must be same as Inorder of the given Binary Tree. The first node of Inorder traversal (left most node in Binary tree) must be head node of the Doubly linked 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>BToDLL()</b> that takes "root" node of binary tree as parameter.

Constraint:-
1 <= Number of Nodes <= 1000
1 <= Node.data <= 1000
The printing is done by the driver code you just need to complete the function.Sample Input:-
3
1 2 3

Sample Output:-
2 1 3

Sample Input:-
5
6 5 4 3 2

Sample Output:-
3 5 2 6 4 , I have written this Solution Code:   static void BToDLL(Node root)  
    { 
        // Base cases 
        if (root == null) 
            return ; 
  
        // Recursively convert right subtree 
        BToDLL(root.right); 
  
        // insert root into DLL 
        root.right = head; 
  
        // Change left pointer of previous head 
        if (head != null) 
            (head).left = root; 
  
        // Change head of Doubly linked list 
        head = root; 
  
        // Recursively convert left subtree 
        BToDLL(root.left); 
    } , In this Programming Language: Java, Now tell me if this Code is compilable or not?