title: How to check if a day lies between a range?
body: <p>I have a job which runs from a given day to a certain day of week . For eg (Monday to Saturday).
  I was able to cover the case when stopday > starday for eg-startday->Monday stopDay->Saturday
  but when the range changes to something like Wednesday to Monday , I am not able to cover this case.</p>
  
  <pre><code>private boolean isNotWindow(DateTime todayDate) {
          final int hr = 3600;
          final int min = 60;
          int stopDay =
                  Integer.parseInt(ShipmentTrackingEmailProperties.getInstance().getProperty(
                          ShipmentTrackingEmailProperties.SHIPMENT_EMAIL_STOP_DAY));
          int startDay =
                  Integer.parseInt(ShipmentTrackingEmailProperties.getInstance().getProperty(
                          ShipmentTrackingEmailProperties.SHIPMENT_EMAIL_START_DAY));
  
          if(stopDay&lt;startDay)
          {
              //Not able to figure out??????
          }
          if (todayDate.getDayOfWeek() &gt;= stopDay) {
              String stopTime =
                      ShipmentTrackingEmailProperties.getInstance().getProperty(ShipmentTrackingEmailProperties.SHIPMENT_EMAIL_STOP_TIME);
              String[] array = stopTime.split(":");
              System.out.println(array[0] + "  " + array[1] + "   " + array[2]);
              int hh = Integer.parseInt(array[0]);
              int mm = Integer.parseInt(array[1]);
              int ss = Integer.parseInt(array[2]);
              int tSec = todayDate.getHourOfDay() * hr + todayDate.getMinuteOfDay() * min + todayDate.getSecondOfDay();
              int sSec = hh * hr + mm * min + ss;
              if (tSec &gt; sSec) {
                       return true;
              }
          }
          if (todayDate.getDayOfWeek() &lt;= startDay) {
              String startTime =
                      ShipmentTrackingEmailProperties.getInstance().getProperty(ShipmentTrackingEmailProperties.SHIPMENT_EMAIL_START_TIME);
              String[] array = startTime.split(":");
              int hh = Integer.parseInt(array[0]);
              int mm = Integer.parseInt(array[1]);
              int ss = Integer.parseInt(array[2]);
              int tSec = todayDate.getHourOfDay() * hr + todayDate.getMinuteOfDay() * min + todayDate.getSecondOfDay();
              int sSec = hh * hr + mm * min + ss;
              if (tSec &lt;= sSec) {
                  LOG.info("Not a valid day to send mail ." + todayDate.getDayOfWeek());
                   return true;
              }
          }
               LOG.info("Valid day to send mail ." + todayDate.getDayOfWeek());
           return false;
      }
  </code></pre>
  
  <p>This function returns true if the day does not fall in a range.So how to cover the case when<br>
  stopDay &lt; startDay</p>