package kotlin.reflect.jvm.internal.impl.descriptors.runtime.structure;

import defpackage.cr4;
import defpackage.h15;
import defpackage.kp6;
import defpackage.pq6;
import defpackage.vx8;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import kotlin.reflect.jvm.internal.impl.name.FqName;

/* JADX INFO: loaded from: classes3.dex */
@vx8
public final class ReflectJavaAnnotationOwnerKt {
    @pq6
    public static final ReflectJavaAnnotation findAnnotation(@kp6 Annotation[] annotationArr, @kp6 FqName fqName) {
        Annotation annotation;
        cr4.g(annotationArr, "<this>");
        cr4.g(fqName, "fqName");
        int length = annotationArr.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                annotation = null;
                break;
            }
            annotation = annotationArr[i];
            if (cr4.b(ReflectClassUtilKt.getClassId(h15.b(h15.a(annotation))).asSingleFqName(), fqName)) {
                break;
            }
            i++;
        }
        if (annotation != null) {
            return new ReflectJavaAnnotation(annotation);
        }
        return null;
    }

    @kp6
    public static final List<ReflectJavaAnnotation> getAnnotations(@kp6 Annotation[] annotationArr) {
        cr4.g(annotationArr, "<this>");
        ArrayList arrayList = new ArrayList(annotationArr.length);
        for (Annotation annotation : annotationArr) {
            arrayList.add(new ReflectJavaAnnotation(annotation));
        }
        return arrayList;
    }
}
