public static long[] getKPrimes(int k, boolean print) {
		long[] primes = new long[k];
		primes[0] = 2;
		int currPrimeCount = 1;
		for(int i=3;currPrimeCount<k;i+=2) { 							// even number cannot be prime
			boolean isPrime = true;
			long sqrt = (long) Math.sqrt(i); 
			for(int j=0; j<currPrimeCount && primes[j]<=sqrt; j++) {
				if (i % primes[j] == 0) {								// test the prime, to see if the prime is the factor of i
					isPrime = false;
					break;
				}
			}
			if (isPrime) {
				primes[currPrimeCount++] = i;
			}
		}

		if(print) {
			System.out.print("First " + k + "th primes are: ");
			System.out.print(Arrays.toString(primes));
			System.out.println();
		}
		
		return primes;
	}