1public class Test {
2
3 public static void main(String [] argv) {
4 long
5 lb = 1,
6 ub = 1000,
7 max = 500;
8
9 CountPrimes worker;
10
11 try {
12 lb = Long.parseLong(argv[0]);
13 ub = Long.parseLong(argv[1]);
14 max = Long.parseLong(argv[2]);
15 }
16 catch (Exception e) {
17 System.err.println("wrong parameters, using defaults");
18 }
19
20 worker = new CountPrimes(lb,ub,max);
21 try {
22 worker.start();
23 worker.join();
24 }
25 catch (InterruptedException e) {
26 }
27
28 System.out.println("The intervall " +
29 lb + " <= i < " + ub +
30 " contains " + worker.noOfPrimes +
31 " primes");
32 }
33}