Deepak and Primes tle shown

sieve of erathonese given tle

import java.util.*;
public class Main {
public static boolean a[]= new boolean[100000001];
public static void main(String args[]) {
Scanner sc= new Scanner(System.in);int n=sc.nextInt();

         for(int i=0;i<=100000000;i++){
             a[i]=true;
         }
         a[0]=false;a[1]=false;
        for(int p=2;p*p<=100000000;p++){
            for(int j=p*p;j<=100000000;j=j+p){
                if(a[j]){
                    a[j]=false;
                }
            }
        }
        //ArrayList<Integer> p1=new ArrayList<>();
        int count=0;
        for(int i=2;i<=100000000;i++){
            if(a[i]){
               count++;
            }
            if(count==n){
                System.out.println(i);break;
            }
        }
       
        
}

}
my solution

seive not giving tle,


well commented sol