public void addGroupedRow(int rowIndex){
  int[][] newRowGroups=getRowGroups();
  if (newRowGroups.length == 0) {
    newRowGroups=new int[][]{{rowIndex}};
  }
 else {
    int lastGroupIndex=newRowGroups.length - 1;
    int[] lastGroup=newRowGroups[lastGroupIndex];
    int groupSize=lastGroup.length;
    int[] newLastGroup=new int[groupSize + 1];
    System.arraycopy(lastGroup,0,newLastGroup,0,groupSize);
    newLastGroup[groupSize]=rowIndex;
    newRowGroups[lastGroupIndex]=newLastGroup;
  }
  setRowGroups(newRowGroups);
}

public void addGroupedRow ( int rowIndex ) { int [ ] [ ] newRowGroups = getRowGroups ( ) ; if ( newRowGroups . length == 0 ) { newRowGroups = new int [ ] [ ] { { rowIndex } } ; } else { int lastGroupIndex = newRowGroups . length - 1 ; int [ ] lastGroup = newRowGroups [ lastGroupIndex ] ; int groupSize = lastGroup . length ; int [ ] newLastGroup = new int [ groupSize + 1 ] ; System . arraycopy ( lastGroup , 0 , newLastGroup , 0 , groupSize ) ; newLastGroup [ groupSize ] = rowIndex ; newRowGroups [ lastGroupIndex ] = newLastGroup ; } setRowGroups ( newRowGroups ) ; }
adds the specified row index to the last row group . in case there are no groups , a new group will be created .
