import java.util.Scanner;
public class java {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int number;
while (input.hasNext()){
number = input.nextInt();
if(number<2 && number>2147483647)continue;
else if(number==2 || number==3 || number==5){
System.out.println("質數");
}
else if(number%2==0){
System.out.println("非質數");
}
else{
for(int i=3; i*i<=number; i+=2){
if(number%i==0){
System.out.println("非質數");
break;
}else if((i+2)*(i+2)>number){
System.out.println("質數");
break;
}
}
}
}
}
}
最近才初學java,請問要如何增加效率?