Rabbit-R1/android (non root)/java/sources/com/google/zxing/qrcode/encoder/ByteMatrix.java

71 lines
1.7 KiB
Java
Raw Normal View History

2024-05-21 21:08:36 +00:00
package com.google.zxing.qrcode.encoder;
import java.lang.reflect.Array;
import java.util.Arrays;
/* loaded from: classes3.dex */
public final class ByteMatrix {
private final byte[][] bytes;
private final int height;
private final int width;
public byte[][] getArray() {
return this.bytes;
}
public int getHeight() {
return this.height;
}
public int getWidth() {
return this.width;
}
public ByteMatrix(int i, int i2) {
this.bytes = (byte[][]) Array.newInstance((Class<?>) Byte.TYPE, i2, i);
this.width = i;
this.height = i2;
}
public byte get(int i, int i2) {
return this.bytes[i2][i];
}
public void set(int i, int i2, byte b) {
this.bytes[i2][i] = b;
}
public void set(int i, int i2, int i3) {
this.bytes[i2][i] = (byte) i3;
}
public void set(int i, int i2, boolean z) {
this.bytes[i2][i] = z ? (byte) 1 : (byte) 0;
}
public void clear(byte b) {
for (byte[] bArr : this.bytes) {
Arrays.fill(bArr, b);
}
}
public String toString() {
StringBuilder sb = new StringBuilder((this.width * 2 * this.height) + 2);
for (int i = 0; i < this.height; i++) {
byte[] bArr = this.bytes[i];
for (int i2 = 0; i2 < this.width; i2++) {
byte b = bArr[i2];
if (b == 0) {
sb.append(" 0");
} else if (b == 1) {
sb.append(" 1");
} else {
sb.append(" ");
}
}
sb.append('\n');
}
return sb.toString();
}
}