code: static Pair<Integer, Integer> defaultAllocationCount(int slabSlotsUsed, int slabBytesUsed, PeekingIterator<Integer> eventSizes) {
          int slabTotalSlotCount = slabSlotsUsed;
          int allocationSlotCount = 0;
          int slabTotalBytesUsed = slabBytesUsed;
          int allocationBytes = 0;
          while (eventSizes.hasNext()) {
              checkArgument(eventSizes.peek() <= Constants.MAX_EVENT_SIZE_IN_BYTES, "Event size (" + eventSizes.peek() + ") is greater than the maximum allowed (" + Constants.MAX_EVENT_SIZE_IN_BYTES + ") event size");
              if (slabTotalSlotCount + 1 <= Constants.MAX_SLAB_SIZE && slabTotalBytesUsed + eventSizes.peek() <= Constants.MAX_SLAB_SIZE_IN_BYTES) {
                  slabTotalSlotCount++;
                  allocationSlotCount++;
                  int eventSize = eventSizes.next();
                  slabTotalBytesUsed += eventSize;
                  allocationBytes += eventSize;
              } else {
                  break;
              }
          }
          return new ImmutablePair<>(allocationSlotCount, allocationBytes);
      }
docs: Compute how many slots in a slab will be used to do a default (new slab) allocation, and how many bytes it will consume
  
  @param slabSlotsUsed - number of available slots in a slab that have been used prior to this allocation
  @param slabBytesUsed - number of bytes in a slab that have been used prior to this allocation
  @param eventSizes - list of the size in bytes of all events that we want to insert into the slab
  
  @return a pair of integers, the left value is the number of slots that will be used by this allocation and the
  right value is the numb er of bytes that will be used by this allocation