package com.google.android.gms.internal.p002firebaseauthapi;

/* JADX INFO: loaded from: classes3.dex */
public class zzak<E> {
    public static int zza(int i6, int i7) {
        if (i7 < 0) {
            throw new IllegalArgumentException("cannot store more than Integer.MAX_VALUE elements");
        }
        if (i7 <= i6) {
            return i6;
        }
        int iHighestOneBit = i6 + (i6 >> 1) + 1;
        if (iHighestOneBit < i7) {
            iHighestOneBit = Integer.highestOneBit(i7 - 1) << 1;
        }
        if (iHighestOneBit < 0) {
            return Integer.MAX_VALUE;
        }
        return iHighestOneBit;
    }
}
