classSolution{publicintsearch(int[] nums,int target){int len = nums.length;int i = len /2;int result =-1;if(target == nums[i])return i;elseif(target > nums[i]&& i != len -1){int[] temp =newint[len - i -1];System.arraycopy(nums,i+1,temp,0,len - i -1);
result =search(temp,target);if(result !=-1) result += i+1;}elseif(target < nums[i]&& i !=0){int[] temp =newint[i];System.arraycopy(nums,0,temp,0,i);
result =search(temp,target);}return result;}}