public class Solution {

public TreeNode sortedArrayToBST(int[] nums) {

int l = nums.length;

if(nums == null || l == 0) return null;

int mid = l/2;

TreeNode result = new TreeNode(nums[mid]);

if(l > 1){

result.left = sortedArrayToBST(Arrays.copyOfRange(nums, 0,mid));

result.right = sortedArrayToBST(Arrays.copyOfRange(nums, mid+1,l));

}

return result;

}

}