Here is what I came up with,
import java.util.*;
class Rotate
{
int transitionPoint(int arr[],int n)
{
int low =0,high =n-1;
int mid = 0;
while(low<=high)
{
mid = low+high/2;
if(arr[mid]==0)
{
if(arr[mid+1]==1)
return (mid+1);
low=mid+1;
}
if(arr[mid]==1)
{
if(arr[mid-1]==0)
return (mid+1);
high = mid-1;
}
}
return mid;
}
}
class TransitionPoint
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
{
arr[i] = sc.nextInt();
}
Rotate obj = new Rotate();
System.out.println(obj.transitionPoint(arr,n));
}
}
}
Hope this will help.