title: Is there a java class that represent a range between two instants?
body: <p>I do want to check if an Instant is between two other instants: </p>
  
  <p>Currently I use:</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.time.format.DateTimeFormatter;
  import java.time.Instant;
  
  Instant start = Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse("2016-10-25T12:31:39.084726218Z"));
  Instant end = Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse("2016-10-25T13:31:39.084726218Z"));
  
  
  // for exclusive range 
  Instant testSubject1 = Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse("2016-10-25T12:31:40Z"));
  boolean isInRange1 = testSubject1.isAfter(start) &amp;&amp; testSubject1.isBefore(end); // this works as exclusive range
  
  //for inclusive range
  Instant testSubject2 = Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse("2016-10-25T12:31:39.084726218Z"));
  boolean isInRange2 = (testSubject2.equals(start) || testSubject2.isAfter(start)) &amp;&amp; (testSubject2.equals(end) || testSubject2.isBefore(end)); // inclusive range
  
  </code></pre>
  
  <p>Is there any other utility function is the standard library or elsewhere that allows for this kind of range check is a simplified way? </p>
  
  <p>I'm looking for something like:</p>
  
  <pre class="lang-java prettyprint-override"><code>new InstantRange(start,end).checkInstantWithin(testSubject1); 
  
  // or
  
  InstantUtils.inRangeExclusive(start,end, testSubject1);
  InstantUtils.inRangeInclusivestart,end, testSubject1);
  
  </code></pre>