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

import java.util.Arrays;

/* JADX INFO: loaded from: classes2.dex */
public final class b extends a {
    public final void a(Object obj) {
        int i10;
        obj.getClass();
        int length = this.f20077a.length;
        int i11 = this.f20078b;
        int i12 = i11 + 1;
        if (i12 < 0) {
            throw new IllegalArgumentException("cannot store more than Integer.MAX_VALUE elements");
        }
        if (i12 <= length) {
            i10 = length;
        } else {
            i10 = (length >> 1) + length + 1;
            if (i10 < i12) {
                int iHighestOneBit = Integer.highestOneBit(i11);
                i10 = iHighestOneBit + iHighestOneBit;
            }
            if (i10 < 0) {
                i10 = Integer.MAX_VALUE;
            }
        }
        if (i10 > length || this.f20079c) {
            this.f20077a = Arrays.copyOf(this.f20077a, i10);
            this.f20079c = false;
        }
        Object[] objArr = this.f20077a;
        int i13 = this.f20078b;
        this.f20078b = i13 + 1;
        objArr[i13] = obj;
    }
}
