what-the-bank/sources/o/UgZ.java

59 lines
1.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/* loaded from: classes.dex */
public final class UgZ {
private static Comparator<byte[]> a = new Comparator<byte[]>() { // from class: o.UgZ.1
@Override // java.util.Comparator
public final /* bridge */ /* synthetic */ int compare(byte[] bArr, byte[] bArr2) {
return bArr.length - bArr2.length;
}
};
private final List<byte[]> d = new ArrayList();
private final List<byte[]> e = new ArrayList(64);
private int c = 0;
private final int b = 4096;
public final byte[] c(int i) {
synchronized (this) {
for (int i2 = 0; i2 < this.e.size(); i2++) {
byte[] bArr = this.e.get(i2);
if (bArr.length >= i) {
this.c -= bArr.length;
this.e.remove(i2);
this.d.remove(bArr);
return bArr;
}
}
return new byte[i];
}
}
public final void d(byte[] bArr) {
synchronized (this) {
if (bArr != null) {
if (bArr.length <= this.b) {
this.d.add(bArr);
int binarySearch = Collections.binarySearch(this.e, bArr, a);
if (binarySearch < 0) {
binarySearch = (-binarySearch) - 1;
}
this.e.add(binarySearch, bArr);
this.c += bArr.length;
synchronized (this) {
while (this.c > this.b) {
byte[] remove = this.d.remove(0);
this.e.remove(remove);
this.c -= remove.length;
}
}
}
}
}
}
}