Wstaw w tablicy

// as a data structure
void insert(int arrElement, int index) {
    int length = arr.length - 1;
    if (index >= 0 && index < length) {
      for (int i = length; i > index; i--) {
        arr[i] = arr[i - 1];
      }
      arr[index] = arrElement;
    }
  }
Old-fashioned Okapi