title: Java - sort only subsection of array
body: <p>I have an array of characters </p>
  
  <pre><code>String a = "badabcde";
  char[] chArr = a.toCharArray(); // 'b','a','d','a','b','c','d','e'
  </code></pre>
  
  <p>What's the easiest way to sort only a section of the array, given a start and end index?</p>
  
  <pre><code>// 'b','a','d','a','b','c','d','e'
  subSort(array, startIndex, endIndex);
  
  Ex: 
  subSort(chArr, 2, 5);
  // 'b','a','a','b','c','d','d','e' // sorts indices 2 to 5 
  </code></pre>