I am having difficulty taking input with scanner
private static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
int t=sc.nextInt());
while(t!=0) {
int low=sc.nextInt());
int high=sc.nextInt());
printSetBits(low,high);
t–;
}
}
private static void printSetBits(int low, int high) {
int total=0;
for(int i=low;i<=high;i++) {
int count=0;
while(i!=0) {
int bit=i&1;
if(bit==1) {
count++;
}
i=i>>1;
}
total+=count;
}
System.out.println(total);
}
}