JBBPFieldUShort extends JBBPAbstractField implements JBBPNumericField { public static long reverseBits(final short value) { final int b0 = JBBPUtils.reverseBitsInByte((byte) value) & 0xFF; final int b1 = JBBPUtils.reverseBitsInByte((byte) (value >> 8)) & 0xFF; return (long) ((b0 << 8) | b1) & 0xFFFFL; } JBBPFieldUShort(final JBBPNamedFieldInfo name, final short value); static long reverseBits(final short value); @Override double getAsDouble(); @Override float getAsFloat(); @Override int getAsInt(); @Override long getAsLong(); @Override boolean getAsBool(); @Override long getAsInvertedBitOrder(); @Override String getTypeAsString();  }
@Test public void testGetValueArrayAsObject() { final short[] array = new short[] {(short) -27834, 23423, 0, -2, 3}; final JBBPFieldArrayUShort test = new JBBPFieldArrayUShort(new JBBPNamedFieldInfo("test.field", "field", 999), array); assertArrayEquals(array, (short[]) test.getValueArrayAsObject(false)); final short[] inverted = (short[]) test.getValueArrayAsObject(true); assertEquals(array.length, inverted.length); for (int i = 0; i < array.length; i++) { assertEquals(JBBPFieldShort.reverseBits(array[i]), inverted[i]); } }