public static ArrayList<Long> getPrimesInRange(long from, long to){
		ArrayList<Long> primes = new ArrayList<Long>();
		ArrayList<Long> primesFinal = new ArrayList<Long>();
		//primes.add(2); // do this at end as this adds that much iterations
		boolean isPrime = true;
		for (long i = 3; i<to; i=i+2){
			isPrime = true;
			for (long prime : primes){
				if(prime>Math.sqrt(i)){
					break;
				}
				if(i%prime == 0){
					isPrime = false;
					break;
				}
			}
			if(isPrime){
				primes.add(i);
				if(i>from){
					primesFinal.add(i);
				}
			}
		}
		primesFinal.add(0,2L);
		return primesFinal;
	}