```
public TreeNode sortedArrayToBST(int[] nums) {
return helper(nums, 0, nums.length-1);
}
private TreeNode helper(int[] nums, int start, int end){
if(start > end || start < 0 || end >= nums.length ) return null;
TreeNode root = new TreeNode(nums[(start + end)/2]);
root.left = helper(nums, start, (start + end)/2-1);
root.right = helper(nums, (start + end)/2+1, end);
return root;
}
```