question: public static void calculateAlignedPositions ( int allocated , SizeRequirements total , SizeRequirements [ ] children , int [ ] offsets , int [ ] spans , boolean normal ) { float totalAlignment = normal ? total . alignment : 1.0f - total . alignment ; int totalAscent = ( int ) ( allocated * totalAlignment ) ; int totalDescent = allocated - totalAscent ; for ( int i = 0 ; i < children . length ; i ++ ) { SizeRequirements req = children [ i ] ; float alignment = normal ? req . alignment : 1.0f - req . alignment ; int maxAscent = ( int ) ( req . maximum * alignment ) ; int maxDescent = req . maximum - maxAscent ; int ascent = Math . min ( totalAscent , maxAscent ) ; int descent = Math . min ( totalDescent , maxDescent ) ; offsets [ i ] = totalAscent - ascent ; spans [ i ] = ( int ) Math . min ( ( long ) ascent + ( long ) descent , Integer . MAX_VALUE ) ; } }
target:  Creates a set of offset/span pairs specifying how to lay out a set of components with the specified alignments. The resulting span allocations will overlap, with each one fitting as well as possible into the given total allocation. This method requires that you specify the total amount of space to be allocated, the size requirements for each component to be placed (specified as an array of SizeRequirements), and the total size requirements of the set of components (only the alignment field of which is actually used) You can get the total size requirement by invoking getAlignedSizeRequirements. This method also requires a flag indicating whether normal or reverse alignment should be performed.  With normal alignment the value 0.0f represents the left/top edge of the component to be aligned.  With reverse alignment, 0.0f represents the right/bottom edge.