```
return findindex(nums,0,nums.length-1,target);}
public int findindex(int[] nums,int low,int high,int target){
if(low==high-1||low==high){
if(target<=nums[high]&&target>nums[low])
return high;
if(target>nums[high])
return high+1;
else return low;
}
int index = low+(high-low)/2;
if (target == nums[index])
return index;
if(target < nums[index])
return findindex(nums,low,index,target);
else
return findindex(nums,index,high,target);
}
```

}