Compute the length of the results array with some space for growth

@param length
the current length
@return the desired length
766781
private static int expandTo(int length) {
        // add 25% + 100 - limit to Integer.Max
        int toAdd = 100 + (length >> 2);
        toAdd = Math.min(UBench.MAX_RESULTS - length, toAdd);
        return toAdd == 0 ? -1 : toAdd + length;
    }
322341
@InterfaceAudience.Public
    public long getLength() {
        Number length = (Number) metadata.get("length");
        if (length != null) {
            return length.longValue();
        } else {
            return 0;
        }
    }
468892
@Override
    public long getLength() throws IOException
    {
        if (_streamLength != -1) {
            return _streamLength;
        }

        isValidIndex(Integer.MAX_VALUE, 1);
        assert(_isStreamFinished);
        return _streamLength;
    }
144325
public T grow() {
		if( size < data.length ) {
			return data[size++];
		} else {
			growArray((data.length+1)*2);
			return data[size++];
		}
	}
1312781
public int lengthOf(String value) {
        int length = 0;
        if (value != null) {
            length = value.length();
        }
        return length;
    }
1076210
public static String getAsterisks(int length) {
		if (length < 1) return "";
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < length; i++) {
			sb.append("*");
		}
		return sb.toString();
	}
544339
public Integer getLength()
   {
      if(childNode.getAttribute("length") != null && !childNode.getAttribute("length").equals("null"))
      {
         return Integer.valueOf(childNode.getAttribute("length"));
      }
      return null;
   }
1018742
public static int lengthOf(WsByteBuffer[] src, int startIndex) {
        int length = 0;
        if (null != src) {
            for (int i = startIndex; i < src.length && null != src[i]; i++) {
                length += src[i].remaining();
            }
        }
        return length;
    }
758956
public static byte[] encodeLength(int length, int offset) {
        if (length < SIZE_THRESHOLD) {
            byte firstByte = (byte) (length + offset);
            return new byte[] { firstByte };
        } else if (length < MAX_ITEM_LENGTH) {
            byte[] binaryLength;
            if (length > 0xFF)
                binaryLength = intToBytesNoLeadZeroes(length);
            else
                binaryLength = new byte[] { (byte) length };
            byte firstByte = (byte) (binaryLength.length + offset + SIZE_THRESHOLD - 1);
            return concatenate(new byte[] { firstByte }, binaryLength);
        } else {
            throw new RuntimeException("Input too long");
        }
    }
371575
public int getLength()
  {
    int length = 0;
    
    for (TempBuffer ptr = _head; ptr != null; ptr = ptr.next()) {
      length += ptr.length();
    }

    return length;
  }
419886
private static int getMaxLength( String[] values )
    {
        int result = 0;
        
        for ( int i = 0, curr = 0; i < values.length; i++ )
        {
            if ( ( curr = values[i].length() ) > result )
            {
                result = curr;
            }
        }
        return result;
    }
738605
public static int[] copyOf(int[] old, int length) {
    int[] newArray = new int[length];
    int minLength = Math.min(old.length, length);
    System.arraycopy(old, 0, newArray, 0, minLength);
    return newArray;
  }
101291
public double getLength() {
		double length = 0;
		if (!isEmpty()) {
			length = exteriorRing.getLength();
			if (interiorRings != null) {
				for (LinearRing interiorRing : interiorRings) {
					length += interiorRing.getLength();
				}
			}
		}
		return length;
	}
95364
@SneakyThrows
    public static Duration newDuration(final String length) {
        if (NumberUtils.isCreatable(length)) {
            return Duration.ofSeconds(Long.parseLong(length));
        }
        return Duration.parse(length);
    }
1126316
public int getLength()
  {      
    // Tell if this is being called from within a predicate.
  	boolean isPredicateTest = (this == m_execContext.getSubContextList());

    // And get how many total predicates are part of this step.
  	int predCount = getPredicateCount();
  	
    // If we have already calculated the length, and the current predicate 
    // is the first predicate, then return the length.  We don't cache 
    // the anything but the length of the list to the first predicate.
    if (-1 != m_length && isPredicateTest && m_predicateIndex < 1)
  		return m_length;
  	
    // I'm a bit worried about this one, since it doesn't have the 
    // checks found above.  I suspect it's fine.  -sb
    if (m_foundLast)
  		return m_pos;
  		
    // Create a clone, and count from the current position to the end 
    // of the list, not taking into account the current predicate and 
    // predicates after the current one.
    int pos = (m_predicateIndex >= 0) ? getProximityPosition() : m_pos;
              
    LocPathIterator clone;

    try
    {
      clone = (LocPathIterator) clone();        
    }
    catch (CloneNotSupportedException cnse)
    {
      return -1;
    }

    // We want to clip off the last predicate, but only if we are a sub 
    // context node list, NOT if we are a context list.  See pos68 test, 
    // also test against bug4638.
    if (predCount > 0 && isPredicateTest)
    {
      // Don't call setPredicateCount, because it clones and is slower.
      clone.m_predCount = m_predicateIndex;
      // The line above used to be:
      // clone.m_predCount = predCount - 1;
      // ...which looks like a dumb bug to me. -sb
    }

    int next;

    while (DTM.NULL != (next = clone.nextNode()))
    {
      pos++;
    }
    
    if (isPredicateTest && m_predicateIndex < 1)
      m_length = pos;
    
    return pos;
  }
1310910
public static String getStrCode(int length) {
        StringBuffer str = new StringBuffer();
        while (str.length() <= length - 1)
            str.append(strArray[new Random().nextInt(strArray.length)]);
        return str.toString();
    }
697865
public long getLength()
  {
    StreamSource indirectSource = _indirectSource;
    
    if (indirectSource != null) {
      return indirectSource.getLength();
    }
    
    TempOutputStream out = _out;
    
    if (out != null) {
      return out.getLength();
    }
    else {
      return -1;
    }
  }