public static IChunk [ ] getLargestAverageWordLengthChunks ( IChunk [ ] chunks ) { double largetAverage = chunks [ 0 ] . getAverageWordsLength ( ) ; int j ; //find the largest average word length for ( j = 1 ; j < chunks . length ; j ++ ) { if ( chunks [ j ] . getAverageWordsLength ( ) > largetAverage ) { largetAverage = chunks [ j ] . getAverageWordsLength ( ) ; } } //get the items that the average word length equals to //the max's. ArrayList < IChunk > chunkArr = new ArrayList < IChunk > ( chunks . length ) ; for ( j = 0 ; j < chunks . length ; j ++ ) { if ( chunks [ j ] . getAverageWordsLength ( ) == largetAverage ) { chunkArr . add ( chunks [ j ] ) ; } } IChunk [ ] lchunk = new IChunk [ chunkArr . size ( ) ] ; chunkArr . toArray ( lchunk ) ; chunkArr . clear ( ) ; return lchunk ; }
2 . largest average word length this rule will return the chunks that own the largest average word length