code: public static Object[] insert (Object[] list, int index, Object element)
      {
          requireNotNull(element);
  
          // make sure we've got a list to work with
          if (list == null) {
              list = new Object[DEFAULT_LIST_SIZE];
          }
  
          // make a note of the size of the array
          int size = list.length;
  
          // expand the list if necessary (the last element contains a
          // value)
          if (list[size-1] != null) {
              list = accomodate(list, size);
          } else {
              // otherwise, pretend the list is one element shorter and
              // we'll overwrite the last null
              size--;
          }
  
          // shift everything down
          System.arraycopy(list, index, list, index+1, size-index);
  
          // stick the element on in
          list[index] = element;
  
          return list;
      }
docs: Inserts the supplied element at the specified position in the
  array, shifting the remaining elements down. The array will be
  expanded if necessary.
  
  @param list the list in which to insert the element. Can be null.
  @param index the index at which to insert the element.
  @param element the element to insert.
  
  @return a reference to the list with element inserted (might not be
  the list you passed in due to expansion, or allocation).