Inserts count null values at index, moving up all the components at index
and greater.

index cannot be greater than the size of the Vector.

@exception  ArrayIndexOutOfBoundsException  if the index was invalid.
496941
public final void insertNullElementsAt(int index, int count)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "insertNullElementsAt",
        new Object[] { new Integer(index), new Integer(count)});

    for (int i = index; i < index + count; i++)
      add(i, null);

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "insertNullElementsAt");
  }
254231
public void setIndex(int index) {
        ElementBase parent = getParent();
        
        if (parent == null) {
            CWFException.raise("Element has no parent.");
        }
        
        int currentIndex = parent.children.indexOf(this);
        
        if (currentIndex < 0 || currentIndex == index) {
            return;
        }
        
        parent.moveChild(currentIndex, index);
    }
600583
public void insert(int n) {
    this.indices.growTo(n + 1, -1);
    assert !this.inHeap(n);
    this.indices.set(n, this.heap.size());
    this.heap.push(n);
    this.percolateUp(this.indices.get(n));
  }
618618
protected void ensureRestrictedIndex(final int index) {
        if (index < 0) throw new IndexOutOfBoundsException("Index (" + index + ") is negative");
        if (index >= size())
            throw new IndexOutOfBoundsException("Index (" + index + ") is greater than or equal to list size (" + (size()) + ")");
    }
477860
public void add(int index, int element)
    {
        if (index == size())//special case, just appending
        {
            add(element);
        }
        else
        {
            boundsCheck(index);
            enlargeIfNeeded(1);
            System.arraycopy(array, index, array, index+1, end-index);
            array[index] = element;
            end++;
        }
    }
1294023
@Override
	public void updateArray(final int columnIndex, final Array x) throws SQLException {
		wrapped.updateArray(columnIndex, x);
	}
611674
void checkIndex(int index, int fieldLength) {
		if (isOutOfBounds(index, fieldLength, capacity())) {
			throw new IndexOutOfBoundsException(
					String.format("index: %d, length: %d (expected: range(0, %d))", index, fieldLength, capacity()));
		}
	}
1065707
@Override
    public void add(int idx, double val) {
        int i = Arrays.binarySearch(indices, 0, used, idx);
        if (i >= 0) {
            // Just add to the existing value.
            values[i] += val;
            return;
        } 
        int insertionPoint = -(i + 1);
        indices = insert(indices, insertionPoint, idx);
        values = insert(values, insertionPoint, val);
        used++;
    }
258689
private void insert(Geometry geom, GeometryIndex index, Coordinate coordinate)
			throws GeometryIndexNotFoundException {
		if (index.hasChild() && geom.getGeometries() != null && geom.getGeometries().length > index.getValue()) {
			insert(geom.getGeometries()[index.getValue()], index.getChild(), coordinate);
		} else if (index.getType() == GeometryIndexType.TYPE_EDGE) {
			insertAfterEdge(geom, index, coordinate);
		} else if (index.getType() == GeometryIndexType.TYPE_VERTEX) {
			insertAfterVertex(geom, index, coordinate);
		} else {
			throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
		}
	}
26029
@Override
  public void update(final long value) {
    count.incrementAndGet();
    int index = (int) (value / binWidth);
    if (index >= numBins) {
      index = numBins - 1;
    }
    values.incrementAndGet(index);
  }
69661
@NonNull
    @Override
    public MutableArray insertArray(int index, Array value) {
        return insertValue(index, value);
    }
368082
@Override
  public boolean addAll(int index, Collection<? extends Float> c) {
    if (index < 0 || index > size) {
      throw new IndexOutOfBoundsException();
    }
    ensureCapacity(size + c.size());
    size += c.size();
    for (int i = size + c.size() - 1, j = size - 1; j >= index; i--, j--) {
      elements[i] = elements[j];
    }
    for (float e : c) {
      elements[index++] = e;
    }
    return c.size() > 0;
  }
527694
private void ensureIndex(final int index) {
        if (index < 0) throw new IndexOutOfBoundsException("Index (" + index + ") is negative");
        if (index > size())
            throw new IndexOutOfBoundsException("Index (" + index + ") is greater than list size (" + (size()) + ")");
    }
697206
public void set(int index, boolean value)
    throws ArrayIndexOutOfBoundsException {
        if (index < 0 || index >= length) {
            throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
        }
        int idx = subscript(index);
        int bit = position(index);

        if (value) {
            repn[idx] |= bit;
        } else {
            repn[idx] &= ~bit;
        }
    }
1013019
void add(int index, IonValueLite child)
        throws ContainedValueException, NullPointerException
    {
        if ((index < 0) || (index > get_child_count()))
        {
            throw new IndexOutOfBoundsException();
        }
        checkForLock();
        validateNewChild(child);

        add_child(index, child);
        patch_elements_helper(index + 1);

        assert((index >= 0)
               && (index < get_child_count())
               && (child == get_child(index))
               && (child._elementid() == index));
    }
1221893
@SuppressWarnings("unchecked")
	public static <T> Object insert(Object array, int index, T... newElements) {
		if (isEmpty(newElements)) {
			return array;
		}
		if(isEmpty(array)) {
			return newElements;
		}
		
		final int len = length(array);
		if (index < 0) {
			index = (index % len) + len;
		}
		
		final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length);
		System.arraycopy(array, 0, result, 0, Math.min(len, index));
		System.arraycopy(newElements, 0, result, index, newElements.length);
		if (index < len) {
			System.arraycopy(array, index, result, index + newElements.length, len - index);
		}
		return result;
	}
1080983
protected void bulkInsertWithComparator() {
        if (insertionBufferSize == 0) {
            return;
        }
        int right = size + insertionBufferSize - 2;
        int left = Math.max(size, right / 2);
        while (insertionBufferSize > 0) {
            --insertionBufferSize;
            array[size] = insertionBuffer[insertionBufferSize];
            insertionBuffer[insertionBufferSize] = null;
            reverse.clear(size);
            ++size;
        }
        while (right > left + 1) {
            left = left / 2;
            right = right / 2;
            for (int j = left; j <= right; j++) {
                fixdownWithComparator(j);
            }
        }
        if (left != 0) {
            int i = dancestor(left);
            fixdownWithComparator(i);
            fixupWithComparator(i);
        }
        if (right != 0) {
            int i = dancestor(right);
            fixdownWithComparator(i);
            fixupWithComparator(i);
        }
        insertionBufferMinPos = 0;
    }