BranchElement br = new BranchElement(parent, curr.getAttributes());
BranchElement br = (BranchElement) createBranchElement(parent, curr.getAttributes());
    private Element[] recreateAfterFracture(Element[] recreate,                                       BranchElement parent, int startFrom,                                       int startOffset)    {      Element[] added = new Element[recreate.length - startFrom];      int j = 0;      for (int i = startFrom; i < recreate.length; i++)        {          Element curr = recreate[i];          int len = curr.getEndOffset() - curr.getStartOffset();          if (curr instanceof LeafElement)            added[j] = createLeafElement(parent, curr.getAttributes(),                                         startOffset, startOffset + len);          else            {              BranchElement br = new BranchElement(parent, curr.getAttributes());              int bSize = curr.getElementCount();              for (int k = 0; k < bSize; k++)                {                  Element bCurr = curr.getElement(k);                  Element[] add = recreateAfterFracture(new Element[] { bCurr }, br, 0,                                        startOffset);                  br.replace(0, 0, add);                                  }              added[j] = br;            }          startOffset += len;          j++;        }      return added;    }