```
class Solution{
public:
int rangeBitwiseAnd(int m,int n){
int m0=m,n0=n,ind=0,i=0,mask=0xFFFFFFFF;
while(n0>0){
if((m0^n0)&1)ind=i+1;
i++;
m0>>=1;n0>>=1;
}
for(i=0;i<ind;i++)mask<<=1;
return n&mask;
}
};
```