int low=0,high=nums.length-1,mid=(low+high)/2; while(mid!=0&&mid!=nums.length-1&&low<=high) ...