code: public static long sizeOnHeapOf(ByteBuffer[] array)
      {
          long allElementsSize = 0;
          for (int i = 0; i < array.length; i++)
              if (array[i] != null)
                  allElementsSize += sizeOnHeapOf(array[i]);
  
          return allElementsSize + sizeOfArray(array);
      }
docs: Memory a ByteBuffer array consumes.