JBBPFieldBit extends JBBPAbstractField implements JBBPNumericField, BitEntity { @Override public long getAsInvertedBitOrder() { return reverseBits((byte) this.value, this.bitNumber); } JBBPFieldBit(final JBBPNamedFieldInfo name, final int value, final JBBPBitNumber bitNumber); static long reverseBits(final byte value, final JBBPBitNumber bits); @Override JBBPBitNumber getBitWidth(); @Override double getAsDouble(); @Override float getAsFloat(); @Override int getAsInt(); @Override long getAsLong(); @Override boolean getAsBool(); @Override long getAsInvertedBitOrder(); @Override String getTypeAsString();  }
@Test public void testGetAsInvertedBitOrder() { assertEquals(1L, new JBBPFieldBit(new JBBPNamedFieldInfo("test.field", "field", 123), 7, JBBPBitNumber.BITS_1).getAsInvertedBitOrder()); assertEquals(4L, new JBBPFieldBit(new JBBPNamedFieldInfo("test.field", "field", 123), 1, JBBPBitNumber.BITS_3).getAsInvertedBitOrder()); assertEquals(0xF0L, new JBBPFieldBit(new JBBPNamedFieldInfo("test.field", "field", 123), 0xF, JBBPBitNumber.BITS_8).getAsInvertedBitOrder()); assertEquals(0x8FL, new JBBPFieldBit(new JBBPNamedFieldInfo("test.field", "field", 123), 0xFF1, JBBPBitNumber.BITS_8).getAsInvertedBitOrder()); assertEquals(0x8L, new JBBPFieldBit(new JBBPNamedFieldInfo("test.field", "field", 123), 0xFF1, JBBPBitNumber.BITS_4).getAsInvertedBitOrder()); }