Java recursive solution
public class Solution {\n        public TreeNode sortedArrayToBST(int[] nums) {\n            if (nums == null || nums.length ==0){\n                return null;
    public class Solution {\n        public TreeNode sortedArrayToBST(int[] nums) {\n            if (nums == null || nums.length ==0){\n                return null;\n            }\n            return getTreeNode(nums, 0, nums.length-1);\n        }\n        \n        private TreeNode getTreeNode(int[] nums, int start, int end){\n            if (start > end){\n                return null;\n            }\n            int middle = start + (end-start)/2;\n            TreeNode n = new TreeNode(nums[middle]);\n            n.left = getTreeNode(nums, start, middle-1);\n            n.right = getTreeNode(nums, middle+1, end);\n            return n;\n        }\n    }
[]