@Test public void getShortTest() { byte[] buffer = new byte[] { 0, 0 }; Assert.assertEquals(0, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 0, 1 }; Assert.assertEquals(1, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 0, 127 }; Assert.assertEquals(127, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 0, -128 }; Assert.assertEquals(128, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 0, -127 }; Assert.assertEquals(129, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 0, -1 }; Assert.assertEquals(255, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 1, 0 }; Assert.assertEquals(256, Deserializer.getShort(buffer, 0)); buffer = new byte[] { 1, 1 }; Assert.assertEquals(257, Deserializer.getShort(buffer, 0)); }
static int getShort(byte[] buffer, int offset) { return buffer[offset] << 8 | (buffer[offset + 1] & 0xff); }
Deserializer { static int getShort(byte[] buffer, int offset) { return buffer[offset] << 8 | (buffer[offset + 1] & 0xff); } }
Deserializer { static int getShort(byte[] buffer, int offset) { return buffer[offset] << 8 | (buffer[offset + 1] & 0xff); } private  Deserializer(); }
Deserializer { static int getShort(byte[] buffer, int offset) { return buffer[offset] << 8 | (buffer[offset + 1] & 0xff); } private  Deserializer();  }
Deserializer { static int getShort(byte[] buffer, int offset) { return buffer[offset] << 8 | (buffer[offset + 1] & 0xff); } private  Deserializer();   }