Sample prime number searching using threads in Java