For this Question: Given a reference to the head of a sorted doubly-linked list and an integer k, your task is to insert the integer k in your doubly linked-list while maintaining the sort.<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>insertnew()</b> that takes head node of the linked list and the integer k as parameter.

Constraints:
1 <= T <= 100
1 <= Node.data <= 1000Return the head of the modified linked list.Sample Input
1
4
1
3
4
10
5

Sample Output
1 3 4 5 10, I have written this Solution Code: public static Node insertnew(Node head,int k) {
        if(head == null){
        Node temp = new Node(k);
        return temp;
    }
    Node temp=head;
        while(temp != null){
        if (temp.val >= k){
            Node x=new Node(k);
           
            x.prev = temp.prev;
            x.next = temp;
            temp.prev = x;
            if (x.prev == null){
                return x;
            }
            else {
                x.prev.next =x;
                return head;
            }
        }
        if (temp.next == null){
            Node x=new Node(k);
            
            x.prev = temp;
            x.next = null;
            temp.next = x;
            break;
        }
        temp = temp.next;
    }
    return head;
        
    }
    , In this Programming Language: Java, Now tell me if this Code is compilable or not?