@Test
  public void testGetWithPosOnMultiBuffers() throws IOException {
    byte[] b = new byte[4];
    byte[] b1 = new byte[4];
    ByteBuffer bb1 = ByteBuffer.wrap(b);
    ByteBuffer bb2 = ByteBuffer.wrap(b1);
    MultiByteBuff mbb1 = new MultiByteBuff(bb1, bb2);
    mbb1.position(2);
    mbb1.putInt(4);
    int res = mbb1.getInt(2);
    byte[] bres = new byte[4];
    bres[0] = mbb1.get(2);
    bres[1] = mbb1.get(3);
    bres[2] = mbb1.get(4);
    bres[3] = mbb1.get(5);
    int expected = Bytes.toInt(bres);
    assertEquals(expected, res);
  }
Test right answer though we span many sub-buffers.
hbase-common/src/test/java/org/apache/hadoop/hbase/nio/TestMultiByteBuff.java