public class SushuDemo2 {
public static void main(String[] args) {
Long x = 90000000000000L;
System.out.println(Long.MAX_VALUE);//9223372036854775807
long start = new Date().getTime();
while (x<Long.MAX_VALUE) {
boolean flag = true;
int sq = (int) Math.sqrt(x);
for (int y = 2; y <= sq; y++) {
if (x % y == 0) {
flag = false;
continue;
}
}
if(flag == true) {
System.out.println(x);
long end = new Date().getTime();
System.out.println(end-start);
}
x++;
}
}
} |
|