I should just make the min=max+1 when i find target, here:
int[] a={1,3,4,5,7,9,10};
int max=6;
int min=0;
int target=1;
while(max>=min)
{
int mid=(max+min)/2;
if(a[mid]==target)
{
Console.Write(a[mid]);
min=max+1;
}
else if(a[mid]>target)
max=mid-1;
else
min=mid+1;
}