JBBPFieldArrayUShort extends JBBPAbstractArrayField<JBBPFieldUShort> implements JBBPNumericArray { @Override public int getAsInt(final int index) { return this.array[index] & 0xFFFF; } JBBPFieldArrayUShort(final JBBPNamedFieldInfo name, final short[] array); short[] getArray(); @Override int size(); @Override JBBPFieldUShort getElementAt(final int index); @Override int getAsInt(final int index); @Override long getAsLong(final int index); @Override boolean getAsBool(final int index); @Override Object getValueArrayAsObject(final boolean reverseBits); @Override String getTypeAsString();  }
@Test public void testGetAsInt() { final int[] etalon = new int[] {-27834 & 0xFFFF, 23423, 0, -2 & 0xFFFF, 3}; for (int i = 0; i < etalon.length; i++) { assertEquals(etalon[i], test.getAsInt(i)); } }
@Test public void testIterable() { final int[] etalon = new int[] {-27834 & 0xFFFF, 23423, 0, -2 & 0xFFFF, 3}; int index = 0; for (final JBBPFieldUShort f : test) { assertEquals(etalon[index++], f.getAsInt()); } }