int end = child.getEndOffset();
int end = child.getEndOffset() - 1;
  float determineMaxLineLength()  {    // if the longest line is cached, return the cached value    if (maxLineLength != -1)      return maxLineLength;    // otherwise we have to go through all the lines and find it    Element el = getElement();    Segment seg = getLineBuffer();    float span = 0;        for (int i = 0; i < el.getElementCount(); i++)          {            Element child = el.getElement(i);            int start = child.getStartOffset();            int end = child.getEndOffset();        try          {            el.getDocument().getText(start, end - start, seg);            }            catch (BadLocationException ex)              {            AssertionError ae = new AssertionError("Unexpected bad location");	    ae.initCause(ex);	    throw ae;              }                if (seg == null || seg.array == null || seg.count == 0)          continue;                    int width = metrics.charsWidth(seg.array, seg.offset, seg.count);        if (width > span)          {            longestLine = child;            span = width;          }      }    maxLineLength = span;    return maxLineLength;  }