The list of methods to do Array Capacity are organized into topic(s).
byte[]
ensureCapacity(byte array[], int capacity) ensure Capacity
if (capacity <= 0 || capacity - array.length <= 0)
return array;
int newCapacity = array.length * 2;
if (newCapacity - capacity < 0)
newCapacity = capacity;
if (newCapacity < 0) {
if (capacity < 0)
throw new OutOfMemoryError();
...
byte[]
ensureCapacity(byte[] bytes, int capacity) Utility method used to ensure the capacity of byte array.
if (bytes.length < capacity) {
int newsize = Math.max(1, bytes.length) << 1;
bytes = Arrays.copyOf(bytes, newsize);
return bytes;
Object[]
reduceCapacity(Object[] arrays) reduce Capacity
if (arrays == null) {
return null;
int lastIndex = arrays.length - 1;
int length = arrays.length;
for (int i = lastIndex; i >= 0; i--) {
if (arrays[i] == null) {
length--;
...