title: Schedule a task every day using ScheduledExecutorService?
body: <p>I am using <code>ScheduledExecutorService</code> to run a particular task at <code>3 AM</code> in the morning everyday. Now I am not sure whether my below code will call <code>MyTask()</code> every <code>3 AM</code> in the morning? As I am not sure whether my logic is right or not</p>
  
  <pre><code>ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
  Date aDate = ......// Current date or parsed date;
  Calendar with = Calendar.getInstance();
  with.setTime(aDate);
  int hour = with.get(Calendar.HOUR);
  int intDelayInHour = hour &lt; 3 ? 3 - hour : 24 - (hour - 3);
  
  scheduler.scheduleAtFixedRate(new MyTask(), intDilayInHour, 24, TimeUnit.HOURS); 
  </code></pre>
  
  <p>And to test this out, I need to wait for one day to see if it is working out and I don't want to do that. </p>
  
  <p>Can anyone help me to identify whether my above code is right or not?</p>