question: private int expandChildren ( Candidate candidate , S2Cell cell , int numLevels ) { numLevels -- ; S2Cell [ ] childCells = new S2Cell [ 4 ] ; for ( int i = 0 ; i < 4 ; ++ i ) { childCells [ i ] = new S2Cell ( ) ; } cell . subdivide ( childCells ) ; int numTerminals = 0 ; for ( int i = 0 ; i < 4 ; ++ i ) { if ( numLevels > 0 ) { if ( region . mayIntersect ( childCells [ i ] ) ) { numTerminals += expandChildren ( candidate , childCells [ i ] , numLevels ) ; } continue ; } Candidate child = newCandidate ( childCells [ i ] ) ; if ( child != null ) { candidate . children [ candidate . numChildren ++ ] = child ; if ( child . isTerminal ) { ++ numTerminals ; } } } return numTerminals ; }
target:  Populate the children of "candidate" by expanding the given number of levels from the given cell. Returns the number of children that were marked "terminal".