question: private static Dimension createThumbDimension ( final BufferedImage image , final int maxWidth , final int maxHeight ) { Dimension dimension = new Dimension ( ) ; if ( image . getWidth ( ) >= image . getHeight ( ) ) { if ( image . getWidth ( ) >= maxWidth ) { dimension . width = maxWidth ; dimension . height = Math . round ( ( ( float ) maxWidth / image . getWidth ( ) ) * image . getHeight ( ) ) ; } else { dimension . height = image . getHeight ( ) ; dimension . width = image . getWidth ( ) ; } } else { if ( image . getHeight ( ) >= maxHeight ) { dimension . height = maxHeight ; dimension . width = Math . round ( ( ( ( float ) maxHeight / image . getHeight ( ) ) * image . getWidth ( ) ) ) ; } else { dimension . height = image . getHeight ( ) ; dimension . width = image . getWidth ( ) ; } } return dimension ; }
target:  creates dimension of thumb.