private static int computeCapacity(final int expectedSize){
  if (expectedSize == 0) {
    return 1;
  }
  final int capacity=(int)FastMath.ceil(expectedSize / LOAD_FACTOR);
  final int powerOfTwo=Integer.highestOneBit(capacity);
  if (powerOfTwo == capacity) {
    return capacity;
  }
  return nextPowerOfTwo(capacity);
}

private static int computeCapacity ( final int expectedSize ) { if ( expectedSize == 0 ) { return 1 ; } final int capacity = ( int ) FastMath . ceil ( expectedSize / LOAD_FACTOR ) ; final int powerOfTwo = Integer . highestOneBit ( capacity ) ; if ( powerOfTwo == capacity ) { return capacity ; } return nextPowerOfTwo ( capacity ) ; }
compute the capacity needed for a given size .
