code: public static int[] add (int[] list, int startIdx, int value)
      {
          // make sure we've got a list to work with
          if (list == null) {
              list = new int[DEFAULT_LIST_SIZE];
          }
  
          // search for a spot to insert yon value; assuming we'll insert
          // it at the end of the list if we don't find one
          int llength = list.length;
          int index = llength;
          for (int i = startIdx; i < llength; i++) {
              if (list[i] == 0) {
                  index = i;
                  break;
              }
          }
  
          // expand the list if necessary
          if (index >= list.length) {
              list = accomodate(list, index);
          }
  
          // stick the value on in
          list[index] = value;
  
          return list;
      }
docs: Adds the specified value to the next empty slot in the specified
  list. Begins searching for empty slots at the specified index. This
  can be used to quickly add values to a list that preserves
  consecutivity by calling it with the size of the list as the first
  index to check.
  
  @param list the list to which to add the value. Can be null.
  @param startIdx the index at which to start looking for a spot.
  @param value the value to add.
  
  @return a reference to the list with the value added (might not be
  the list you passed in due to expansion, or allocation).