code: private static void insertionSort(int[] data, final int start, final int end, IntComparator comp) {
      // Classic insertion sort.
      for(int i = start + 1; i < end; i++) {
        final int cur = data[i];
        int j = i - 1;
        while(j >= start) {
          final int pre = data[j];
          if(comp.compare(cur, pre) >= 0) {
            break;
          }
          data[j + 1] = pre;
          --j;
        }
        data[j + 1] = cur;
      }
    }
docs: Insertion sort, for short arrays.
  
  @param data Data to sort
  @param start First index
  @param end Last index (exclusive!)
  @param comp Comparator