title: Java split array into ranges
body: <p>Using Java, I want to split an array of <code>int</code>s into an array of ranges. For example, the array</p>
  
  <pre><code>[1, 2, 3, 4, 5, 6, 7, 8, 100, 101, 102, 103]
  </code></pre>
  
  <p>would return</p>
  
  <pre><code>[Range(1, 8), Range(100, 103)]
  </code></pre>
  
  <p>because it consists of 1 to 8 and 100 to 103</p>
  
  <p>It would be best if there were a library, but any sort of method of this conversion is fine.</p>