private int computeCapacity ( int initial ) { if ( initial < MINIMUM_CAPACITY ) { return MINIMUM_CAPACITY ; } if ( initial > MAXIMUM_CAPACITY ) { return MAXIMUM_CAPACITY ; } int capacity = 1 ; while ( capacity < initial ) { capacity <<= 1 ; } return capacity ; }
Compute capacity given initial capacity .