code: private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
  
          // If end occurs before start, convert to equivalent case where start
          // start is before end
          if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))
              return !isActive(inactiveStart, activeStart);
  
          // Get current time
          Calendar current = Calendar.getInstance();
  
          // State is active iff the current time is between the start and end
          return !(activeStart != null && current.before(activeStart))
              && !(inactiveStart != null && current.after(inactiveStart));
  
      }
docs: Given a time when a particular state changes from inactive to active,
  and a time when a particular state changes from active to inactive,
  determines whether that state is currently active.
  
  @param activeStart
  The time at which the state changes from inactive to active.
  
  @param inactiveStart
  The time at which the state changes from active to inactive.
  
  @return
  true if the state is currently active, false otherwise.