Segemented sieve problem

package Eclips_projects;
import java.util.*;
class Aclass{
public static void main(String args[]) {
int prime[]=new int[100000];
ArrayListp=new ArrayList<>();
Scanner sc=new Scanner(System.in);

	primeSieve(prime,p);
	int t=sc.nextInt();
	while(t-->0) {
		int m=sc.nextInt();
		int n=sc.nextInt();
		int segment[]=new int[n-m+1];
		for(int x:p) {
			int start=(m/x)*x;
			if(x>=m && x<n) {
				start=2*x;
			}
			if(start-m<0) {
				start=start+x;
			}
			for(int i=start;i<n;i=i+x) {
				segment[i-m]=1;
			}
		}
		for(int i=m;i<n;i++) {
			if(segment[i-m]==0 && i!=1) {
				System.out.println(i);
			}
		}
	}
	
	
}
static void primeSieve(int prime[],ArrayList<Integer>p) {
	for(int i=3;i<100000;i=i+2) {
		prime[i]=1;
	}
	p.add(2);
	for(long i=3;i<100000;i=i+2) {
		if(prime[(int)i]==1) {
			p.add((int) i);
			for(long j=i*i;j<100000;j=j+i) {
				prime[(int)j]=0;
			}
		}
	}
	prime[2]=1;
}

}

this code is failed in 2 testcases .

@Affan-Mokarram-202031887744398
Please send your code on CB IDE

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.