public void insert(int n, int value) {
    if (n > size) {
      throw new IndexOutOfBoundsException("n > size()");
    }

    growIfNeeded();

    System.arraycopy(values, n, values, n + 1, size - n);
    values[n] = value;
    size++;

    sorted =
        sorted && (n == 0 || value > values[n - 1]) && (n == (size - 1) || value < values[n + 1]);
  }
Inserts element into specified index, moving elements at and above that index up one. May not
be used to insert at an index beyond the current size (that is, insertion as a last element is
legal but no further).

@param n {@code >= 0, <=size();} index of where to insert
@param value value to insert
android/android_framework/dex-maker/src/main/java/com/android/dx/util/IntList.java