Two test cases are not passing

I think my code is accurate, still not passing all the test cases

"import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
while (n > 0) {
int a = scn.nextInt();
int b = scn.nextInt();
System.out.println(visit(a, b));
nā€“;
}

}

public static int visit(int a, int b) {
	int arr[] = new int[b + 1];
	for (int i = 0; i <= b; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i * i <= b; i++) {
		if (arr[i] == 1) {
			for (int j = i * i; j <= b; j += i) {
				arr[j] = 0;
			}
		}
	}
	int count = 0;
	if (a == 1) {
		a = a + 1;
	}
	for (int i = a; i <= b; i++) {
		if (arr[i] == 1) {
			count++;
		}
	}
	return count;
}

}"