@Test
   public void testBasicOperations()
   {
      ByteBuffer buffer = new ByteBuffer();
      byte[] array = buffer.toArray();
      assertEquals(0, array.length);
      assertTrue(buffer.isEmpty());

      buffer.add(1);
      array = buffer.toArray();
      assertEquals(1, array.length);
      assertEquals(1, array[0]);
      assertFalse(buffer.isEmpty());

      buffer.clear();
      array = buffer.toArray();
      assertEquals(0, array.length);
   }