code: public boolean shrink(int maxCapacity) {
          if (maxCapacity >= array.length) {
              return false;
          }
  
          int[] newArray = new int[maxCapacity];
          System.arraycopy(array, 0, newArray, 0, maxCapacity);
          array = newArray;
          return true;
      }
docs: Shrinks the storage to the specified maximum capacity.
  <p>
  If the current capacity is less or equal to the specified capacity, nothing happens.
  
  @param maxCapacity
  the maximal number of elements the storage array has to provide room for.
  
  @return <code>true</code> iff the storage array had to be resized, <code>false</code> otherwise.