question: public Image flipImageVertically ( Image image , boolean maintainOpacity ) { int [ ] rgb = image . getRGB ( ) ; int [ ] newRGB = new int [ rgb . length ] ; int width = image . getWidth ( ) ; int height = image . getHeight ( ) ; for ( int y = 0 ; y < height ; y ++ ) { for ( int x = 0 ; x < width ; x ++ ) { newRGB [ x + ( height - y - 1 ) * width ] = rgb [ x + y * width ] ; } } return EncodedImage . createFromRGB ( newRGB , width , height , ! maintainOpacity ) ; }
target:  Flips the given image on the vertical axis