public TreeNode sortedListToBST(ListNode head) {
        if(head ==null)
            return null;
        //convet to a array;
        Vector<Integer> v = new Vector<Integer>();
        while(head != null){
            v.add(head.val);
            head = head.next;
        }
        return buildTree(v ,0, v.size()-1);
    }