Whats the problem in my code

import java.util.Scanner;

public class ArrayTry {
static Scanner scn = new Scanner(System.in);

public static void main(String[] args) {
	int n = scn.nextInt();
	for (int c = 1; c <= n; c++) {
		int a = scn.nextInt();
		int b = scn.nextInt();
		int[] array = new int[b - a + 1];
		for (int i = 0; i < array.length; i++) {
			array[i] = a;
			a++;
		}
		Display(array);
	}
}

public static void Display(int[] arr) {
	int s = 0;
	for (int r = 0; r < arr.length; r++) {
		int i = 2;
		while (i <= arr[r] - 1) {
			if (arr[r] % i == 0)
				break;
			i = i + 1;
		}
		if (i == arr[r])
			s += 1;
	}
	System.out.println(s);

}

}

hey @Harsh_Sonwani
Constraints

a<=1000000 & b<=1000000.
N<=1000
Constraints is too big. try to find prime number in 0(sqrt(N)) time

still not getting. sir help me plz edit my code & send it to me

@Harsh_Sonwani


you can see this