this is a easy understandable way similar to the 109 problem

public class Solution {

```
private int i=0;
public TreeNode sortedArrayToBST(int[] nums) {
int len=nums.length;
return function(nums,0,len-1);
}
public TreeNode function(int[] nums,int start,int end){
if(start>end) return null;
int mid=start+(end-start)/2;
TreeNode left=function(nums,start,mid-1);
TreeNode tree=new TreeNode(nums[i]);
tree.left=left;
i++;
tree.right=function(nums,mid+1,end);
return tree;
}
```

}