code: protected static int[] accomodate (int[] list, int index)
      {
          int size = list.length;
          // expand size by powers of two until we're big enough
          while (size <= index) {
              size = Math.max(size * 2, DEFAULT_LIST_SIZE);
          }
  
          // create a new list and copy the contents
          int[] newlist = new int[size];
          System.arraycopy(list, 0, newlist, 0, list.length);
          return newlist;
      }
docs: Creates a new list that will accomodate the specified index and
  copies the contents of the old list to the first.