synchronized void ensureParentIndexCapacity(int start, int length, int parentId) {
    int end = start + length;
    if (null == parentIndex) {
      parentIndex = new int[end];
      Arrays.fill(parentIndex, parentId);
    }
    else {
      int newLength = parentIndex.length;
      while (newLength < end) newLength *= 2;
      if (newLength > parentIndex.length) {
        parentIndex = Arrays.copyOfRange(parentIndex, 0, newLength);
        Arrays.fill(parentIndex, end, newLength, -1);
      }
      Arrays.fill(parentIndex, start, end, parentId);
    }
    if (null == godparentIndex) {
      godparentIndex = new int[end];
      Arrays.fill(godparentIndex, -1);
    }
    else {
      int newLength = godparentIndex.length;
      while (newLength < end) newLength *= 2;
      if (newLength > godparentIndex.length) {
        int prevLength = godparentIndex.length;
        godparentIndex = Arrays.copyOfRange(godparentIndex, 0, newLength);
        Arrays.fill(godparentIndex, prevLength, newLength, -1);
      }
    }
  }
synchronized void ensureParentIndexCapacity ( int start , int length , int parentId ) { int end = start + length ; if ( null == parentIndex ) { parentIndex = new int [ end ] ; Arrays . fill ( parentIndex , parentId ) ; } else { int newLength = parentIndex . length ; while ( newLength < end ) newLength *= 2 ; if ( newLength > parentIndex . length ) { parentIndex = Arrays . copyOfRange ( parentIndex , 0 , newLength ) ; Arrays . fill ( parentIndex , end , newLength , - 1 ) ; } Arrays . fill ( parentIndex , start , end , parentId ) ; } if ( null == godparentIndex ) { godparentIndex = new int [ end ] ; Arrays . fill ( godparentIndex , - 1 ) ; } else { int newLength = godparentIndex . length ; while ( newLength < end ) newLength *= 2 ; if ( newLength > godparentIndex . length ) { int prevLength = godparentIndex . length ; godparentIndex = Arrays . copyOfRange ( godparentIndex , 0 , newLength ) ; Arrays . fill ( godparentIndex , prevLength , newLength , - 1 ) ; } } }
Ensure parent index capacity.

@param start    the start
@param length   the length
@param parentId the parent id