question: private static Size clampSize ( Size original , double maxArea , Size maxSize ) { if ( original . getWidth ( ) * original . getHeight ( ) < maxArea && original . getWidth ( ) < maxSize . getWidth ( ) && original . getHeight ( ) < maxSize . getHeight ( ) ) { return original ; } double ratio = Math . min ( Math . sqrt ( maxArea / original . area ( ) ) , 1.0f ) ; int width = ( int ) Math . round ( original . width ( ) * ratio ) ; int height = ( int ) Math . round ( original . height ( ) * ratio ) ; if ( width > maxSize . width ( ) || height > maxSize . height ( ) ) { return computeFitWithinSize ( original , maxSize ) ; } return new Size ( width , height ) ; }
target:  Given a size, compute a value such that it will downscale the original size to fit within the maxSize bounding box and to be less than the provided area. This will never upscale sizes.