follow these steps:
1. let say you need to findout all the primes till number n
2. create a outer for loop which will iterate from 1 to n (let say int i)
3. create a inner for loop(int j) and chk i%j
4. for prime numbers i%j will be 0

don't just hand out code. the purpose of this forum is to help him learn the language, not to do his work for him and help him cheat his way through college

public class Main {
public static void main(String[] args) {
long timeCheck;
long periodOfTime;
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
long initialDelay = 0; // ...