docs: private void ensureCapacity(final int index, final int length)
      {
          if (index < 0)
          {
              throw new IndexOutOfBoundsException("index cannot be negative: index=" + index);
          }
  
          final long resultingPosition = index + (long)length;
          final int currentArrayLength = byteArray.length;
          if (resultingPosition > currentArrayLength)
          {
              if (currentArrayLength >= MAX_ARRAY_LENGTH)
              {
                  throw new IndexOutOfBoundsException(
                      "index=" + index + " length=" + length + " maxCapacity=" + MAX_ARRAY_LENGTH);
              }
  
              byteArray = Arrays.copyOf(byteArray, calculateExpansion(currentArrayLength, (int)resultingPosition));
          }
      }