package o; import com.google.common.primitives.UnsignedBytes; /* loaded from: classes2.dex */ public final class JGk { public final byte[] b; public int c; public int e; public JGk(byte[] bArr) { this.b = bArr; } public final int a(int i) { if (i > 0 && i <= 32) { int length = (this.b.length - this.e) << 3; int i2 = this.c; if (i <= length - i2) { int i3 = 0; if (i2 > 0) { int i4 = 8 - i2; int min = Math.min(i, i4); int i5 = i4 - min; byte[] bArr = this.b; int i6 = this.e; byte b = bArr[i6]; i -= min; int i7 = this.c + min; this.c = i7; if (i7 == 8) { this.c = 0; this.e = i6 + 1; } i3 = (((255 >> (8 - min)) << i5) & b) >> i5; } if (i <= 0) { return i3; } while (i >= 8) { byte[] bArr2 = this.b; int i8 = this.e; i3 = (i3 << 8) | (bArr2[i8] & UnsignedBytes.MAX_VALUE); this.e = i8 + 1; i -= 8; } if (i <= 0) { return i3; } int i9 = 8 - i; int i10 = (i3 << i) | ((((255 >> i9) << i9) & this.b[this.e]) >> i9); this.c += i; return i10; } } throw new IllegalArgumentException(String.valueOf(i)); } }