package a.c.b;

import androidx.core.internal.view.SupportMenu;
import com.google.common.primitives.UnsignedBytes;

public final class b {
    private b() {
    }

    public static int a(byte[] bArr, int i) {
        j.b(bArr, "byteArray");
        if (bArr.length >= i + 4) {
            return (bArr[i + 3] & UnsignedBytes.MAX_VALUE) | ((bArr[i] & UnsignedBytes.MAX_VALUE) << 24) | ((bArr[i + 1] & UnsignedBytes.MAX_VALUE) << 16) | ((bArr[i + 2] & UnsignedBytes.MAX_VALUE) << 8);
        }
        throw new l("Read int from protocol bytes error");
    }

    public static void a(byte[] bArr, int i, int i2) {
        j.b(bArr, "byteArray");
        if (bArr.length >= i + 4) {
            bArr[i] = (byte) ((i2 >>> 24) & 255);
            bArr[i + 1] = (byte) ((i2 >>> 16) & 255);
            bArr[i + 2] = (byte) ((i2 >>> 8) & 255);
            bArr[i + 3] = (byte) (i2 & 255);
            return;
        }
        throw new l("Read int from protocol bytes error");
    }

    public static void a(byte[] bArr, int i, short s) {
        j.b(bArr, "byteArray");
        if (bArr.length >= i + 2) {
            bArr[i] = (byte) ((s >>> 8) & 255);
            bArr[i + 1] = (byte) (s & 255);
            return;
        }
        throw new l("Read int from protocol bytes error");
    }

    public static short b(byte[] bArr, int i) {
        j.b(bArr, "byteArray");
        if (bArr.length >= i + 2) {
            return (short) (((bArr[i + 1] & UnsignedBytes.MAX_VALUE) | ((bArr[i] & UnsignedBytes.MAX_VALUE) << 8)) & SupportMenu.USER_MASK);
        }
        throw new l("Read int from protocol bytes error");
    }
}
