code: protected static int getBucketCount (int capacity, float loadFactor)
      {
          int size = (int)(capacity / loadFactor);
          int highest = Integer.highestOneBit(size);
          return Math.max((size == highest) ? highest : (highest << 1), MIN_BUCKET_COUNT);
      }
docs: Computes the number of buckets needed to provide the given capacity with the specified load
  factor.