Prime number program in java without using for loop