Basic Doubt in input

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);
}

}

Hey @Rishabh8488
input Format is fine
problem in printsetBits fun
Your code is going into infinite loop
correct code
import java.util.*;

import java.util.Scanner;

public class Main {

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 p = low; p <= high; p++) {
int count = 0;
int i = p;
while (i != 0) {
int bit = i & 1;
if (bit == 1) {
count++;
}
i = i >> 1;
}

		total += count;
	}
	System.out.println(total);
}

}