public static int searchinRotatedArray(int[] A, int target) {
        int start = 0; 
        int end = A.length-1;
        int mid;
        
        while(start<=end)
        {
            mid = (start+end)/2;
            if(A[mid] == target)
                return mid;
            else
            {
                if(A[start]<=A[mid])
                {
                    if(target<A[start] || target >A[mid])
                        start = mid+1; 
                    else
                        end = mid-1;
                }else
                {
                    if(target<A[mid] || target >A[end])
                        end = mid-1;
                    else
                        start = mid+1; 
                }
            }
            
        }
        
        return -1;
        
    }