why below code showing wrong output …technically it should be right problem link
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
String str=sc.next();
int y=1;
int x=Integer.parseUnsignedInt(str,2);
int max=x^(x>>y);
for(int i=2;i<=n;i++){
int temp=x^(x>>i);
if(temp>max){max=temp; y=i;}
}
System.out.println(y);
}
}catch(Exception e){
return;
}
}
}