package io.netty.util.internal;

import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public final class ObjectUtil {
    private ObjectUtil() {
    }

    public static <T> T[] checkNonEmpty(T[] tArr, String str) {
        checkNotNull(tArr, str);
        checkPositive(tArr.length, str + ".length");
        return tArr;
    }

    public static <T> T checkNotNull(T t2, String str) {
        Objects.requireNonNull(t2, str);
        return t2;
    }

    public static int checkPositive(int i2, String str) {
        if (i2 > 0) {
            return i2;
        }
        throw new IllegalArgumentException(str + ": " + i2 + " (expected: > 0)");
    }

    public static long checkPositive(long j2, String str) {
        if (j2 > 0) {
            return j2;
        }
        throw new IllegalArgumentException(str + ": " + j2 + " (expected: > 0)");
    }

    public static int checkPositiveOrZero(int i2, String str) {
        if (i2 >= 0) {
            return i2;
        }
        throw new IllegalArgumentException(str + ": " + i2 + " (expected: >= 0)");
    }

    public static long checkPositiveOrZero(long j2, String str) {
        if (j2 >= 0) {
            return j2;
        }
        throw new IllegalArgumentException(str + ": " + j2 + " (expected: >= 0)");
    }

    public static int intValue(Integer num, int i2) {
        return num != null ? num.intValue() : i2;
    }

    public static long longValue(Long l2, long j2) {
        return l2 != null ? l2.longValue() : j2;
    }
}
