[java] Calculating and printing the nth prime number