package org.snmp4j.security;

/* JADX INFO: loaded from: classes.dex */
public class ByteArrayWindow {
    private int length;
    private int offset;
    private byte[] value;

    public ByteArrayWindow(byte[] bArr, int i2, int i3) {
        this.value = bArr;
        this.offset = i2;
        this.length = i3;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof ByteArrayWindow)) {
            return false;
        }
        ByteArrayWindow byteArrayWindow = (ByteArrayWindow) obj;
        if (byteArrayWindow.length != this.length) {
            return false;
        }
        for (int i2 = 0; i2 < this.length; i2++) {
            if (byteArrayWindow.value[i2] != this.value[i2]) {
                return false;
            }
        }
        return true;
    }

    public byte get(int i2) {
        if (i2 < this.length) {
            if (i2 >= 0) {
                return this.value[i2 + this.offset];
            }
            throw new IndexOutOfBoundsException("" + i2);
        }
        throw new IndexOutOfBoundsException("" + i2 + " >= " + this.length);
    }

    public int getLength() {
        return this.length;
    }

    public int getOffset() {
        return this.offset;
    }

    public byte[] getValue() {
        return this.value;
    }

    public void set(int i2, byte b) {
        if (i2 >= this.length) {
            throw new IndexOutOfBoundsException("" + i2 + " >= " + this.length);
        }
        if (i2 >= 0) {
            this.value[i2 + this.offset] = b;
            return;
        }
        throw new IndexOutOfBoundsException("" + i2);
    }

    public void setValue(byte[] bArr) {
        this.value = bArr;
    }

    public boolean equals(ByteArrayWindow byteArrayWindow, int i2) {
        if (byteArrayWindow.length < i2 || this.length < i2) {
            return false;
        }
        for (int i3 = 0; i3 < i2; i3++) {
            if (this.value[this.offset + i3] != byteArrayWindow.value[byteArrayWindow.offset + i3]) {
                return false;
            }
        }
        return true;
    }
}
