package com.tencent.mm.plugin.music.cache;

import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.BitSet;

public class d$a {
    public static byte[] a(BitSet bitSet) {
        AppMethodBeat.i(137402);
        byte[] bArr = new byte[(bitSet.size() / 8)];
        for (int i = 0; i < bitSet.size(); i++) {
            int i2;
            int i3 = i / 8;
            int i4 = 7 - (i % 8);
            byte b = bArr[i3];
            if (bitSet.get(i)) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            bArr[i3] = (byte) ((i2 << i4) | b);
        }
        AppMethodBeat.o(137402);
        return bArr;
    }

    public static BitSet bb(byte[] bArr) {
        AppMethodBeat.i(137403);
        BitSet bitSet = new BitSet(bArr.length * 8);
        int i = 0;
        for (byte b : bArr) {
            int i2 = 7;
            while (i2 >= 0) {
                boolean z;
                int i3 = i + 1;
                if (((b & (1 << i2)) >> i2) == 1) {
                    z = true;
                } else {
                    z = false;
                }
                bitSet.set(i, z);
                i2--;
                i = i3;
            }
        }
        AppMethodBeat.o(137403);
        return bitSet;
    }
}
