What is the error in this

import java.util.*;

public class Main {
public static void main(String args[]) {

	//used the Prime Sieve algo..

	Scanner sc = new Scanner(System.in);
	int t = sc.nextInt();
	while(t-->0){

	
	int[] arr = new int[100000];


	for(int i=3;i<100000;i+=2){
		arr[i] = 1;
	}

	for(int i=3;i<100000;i+=2){
		
		if(arr[i] == 1){

			for (int j=i*i;j<100000 ;j = j+i) {
				arr[j] = 0;
			}


		}

	}

		arr[0] = 0;
		arr[1] = 1;
		arr[2] = 1;


	
	int n=sc.nextInt();

	int count =0;

			for(int i=0;i<10000;i++){
				if(arr[i] == 1){
					if(count == n){
					System.out.println(i+" ");
					break;
					}
					count ++;
				}
		}
	}

}

}

last vale loop me i < 100000 h

last vale loop me i < 100000 hai

Hey @amankumar7017
import java.util.*;

public class Main {
public static void main(String args[]) {

	// used the Prime Sieve algo..

	Scanner sc = new Scanner(System.in);
	int t = sc.nextInt();
	while (t-- > 0) {

		int[] arr = new int[100000];

// for (int i = 3; i < 100000; i += 2) {
// arr[i] = 1;
// }
Arrays.fill(arr, 1);

		for (int i = 2; i * i < 100000; i++) {

			if (arr[i] == 1) {

				for (int j = 2; j * i < 100000; j++) {
					arr[j * i] = 0;
				}

			}

		}

		arr[0] = 0;
		arr[1] = 1;
		arr[2] = 1;

		int n = sc.nextInt();

		int count = 0;

		for (int i = 0; i < 10000; i++) {
			if (arr[i] == 1) {
				if (count == n) {
					System.out.println(i + " ");
					break;
				}
				count++;
			}
		}
	}

}

}
Change the Size of array . because you needed to print 1o^6th prime