ByteRead { public static byte getByte(byte[] src, int startIndex) { Check.EnsureIndex(src, startIndex, 1); return (byte) (src[startIndex] & MASK_BYTE); } private  ByteRead(); static byte getByte(byte[] src, int startIndex); static boolean getBoolean(byte[] src, int startIndex); static short getUnsignedByte(byte[] src, int startIndex); static short getShort(byte[] src, int startIndex); static int getInt(byte[] src, int startIndex); static long getLong(byte[] src, int startIndex); static byte[] getBytes(byte[] src, int startIndex); static byte[] getBytes(byte[] src, int startIndex, int size);  }
@Test public void testByte() { final byte TEST_CASE = 111; ByteBuffer buffer = ByteBuffer.allocate(1); buffer = buffer.order(ByteOrder.BIG_ENDIAN); buffer.put(TEST_CASE); byte readByte = ByteRead.getByte(buffer.array(), 0); Assert.assertEquals(TEST_CASE, readByte); }