MCPcopy Create free account
hub / github.com/antlr/codebuff / ensureCapacity

Method ensureCapacity

corpus/java/training/guava/primitives/Bytes.java:189–193  ·  view source on GitHub ↗

Returns an array containing the same values as array, but guaranteed to be of a specified minimum length. If array already has a length of at least minLength, it is returned directly. Otherwise, a new array of size minLength + padding is returned, containing the value

(byte[] array, int minLength, int padding)

Source from the content-addressed store, hash-verified

187 * {@code minLength}
188 */
189 public static byte[] ensureCapacity(byte[] array, int minLength, int padding) {
190 checkArgument(minLength >= 0, "Invalid minLength: %s", minLength);
191 checkArgument(padding >= 0, "Invalid padding: %s", padding);
192 return (array.length < minLength) ? Arrays.copyOf(array, minLength + padding) : array;
193 }
194
195 /**
196 * Returns an array containing each value of {@code collection}, converted to a {@code byte} value

Callers

nothing calls this directly

Calls 2

checkArgumentMethod · 0.45
copyOfMethod · 0.45

Tested by

no test coverage detected