private static int[] groupedSizes(int[][] groups,int[] rawSizes){
  if (groups == null || groups.length == 0) {
    return rawSizes;
  }
  int[] sizes=new int[rawSizes.length];
  for (int i=0; i < sizes.length; i++) {
    sizes[i]=rawSizes[i];
  }
  for (  int[] groupIndices : groups) {
    int groupMaxSize=0;
    for (    int groupIndice : groupIndices) {
      int index=groupIndice - 1;
      groupMaxSize=Math.max(groupMaxSize,sizes[index]);
    }
    for (    int groupIndice : groupIndices) {
      int index=groupIndice - 1;
      sizes[index]=groupMaxSize;
    }
  }
  return sizes;
}

private static int [ ] groupedSizes ( int [ ] [ ] groups , int [ ] rawSizes ) { if ( groups == null || groups . length == 0 ) { return rawSizes ; } int [ ] sizes = new int [ rawSizes . length ] ; for ( int i = 0 ; i < sizes . length ; i ++ ) { sizes [ i ] = rawSizes [ i ] ; } for ( int [ ] groupIndices : groups ) { int groupMaxSize = 0 ; for ( int groupIndice : groupIndices ) { int index = groupIndice - 1 ; groupMaxSize = Math . max ( groupMaxSize , sizes [ index ] ) ; } for ( int groupIndice : groupIndices ) { int index = groupIndice - 1 ; sizes [ index ] = groupMaxSize ; } } return sizes ; }
computes and returns the grouped sizes . gives grouped columns and rows the same size .
