@Test public void testUnpack() { int[] data = new int[] { PkgInt.pack4bits(0, 1, 2, 3, 4, 5, 6, 7), PkgInt.pack4bits(8, 9, 10, 11, 12, 13, 14, 15) }; PkgInt pkg = new PkgInt( PkgInt.INDEX_SHIFT_4BITS, PkgInt.SHIFT_MASK_4BITS, PkgInt.BIT_SHIFT_4BITS, PkgInt.UNIT_MASK_4BITS, data); for (int i=0; i<16; ++i) { int n = pkg.unpack(i); if (n != i) { fail("Invalid packed value."); } } }
public int unpack(int i) { return ( (this.data[i>>this.indexShift] >> ((i&this.shiftMask)<<this.bitShift)) & this.unitMask ); }
PkgInt { public int unpack(int i) { return ( (this.data[i>>this.indexShift] >> ((i&this.shiftMask)<<this.bitShift)) & this.unitMask ); } }
PkgInt { public int unpack(int i) { return ( (this.data[i>>this.indexShift] >> ((i&this.shiftMask)<<this.bitShift)) & this.unitMask ); } PkgInt(
            int indexShift,
            int shiftMask,
            int bitShift,
            int unitMask,
            int[] data); }
PkgInt { public int unpack(int i) { return ( (this.data[i>>this.indexShift] >> ((i&this.shiftMask)<<this.bitShift)) & this.unitMask ); } PkgInt(
            int indexShift,
            int shiftMask,
            int bitShift,
            int unitMask,
            int[] data); static int pack16bits(int a, int b); static int pack8bits(int a, int b, int c, int d); static int pack4bits(int a, int b, int c, int d, int e, int f, int g, int h); int unpack(int i); }
PkgInt { public int unpack(int i) { return ( (this.data[i>>this.indexShift] >> ((i&this.shiftMask)<<this.bitShift)) & this.unitMask ); } PkgInt(
            int indexShift,
            int shiftMask,
            int bitShift,
            int unitMask,
            int[] data); static int pack16bits(int a, int b); static int pack8bits(int a, int b, int c, int d); static int pack4bits(int a, int b, int c, int d, int e, int f, int g, int h); int unpack(int i); static final int INDEX_SHIFT_4BITS; static final int INDEX_SHIFT_8BITS; static final int INDEX_SHIFT_16BITS; static final int SHIFT_MASK_4BITS; static final int SHIFT_MASK_8BITS; static final int SHIFT_MASK_16BITS; static final int BIT_SHIFT_4BITS; static final int BIT_SHIFT_8BITS; static final int BIT_SHIFT_16BITS; static final int UNIT_MASK_4BITS; static final int UNIT_MASK_8BITS; static final int UNIT_MASK_16BITS; }