question: public static void doFlip ( ByteBuffer bBuf , int width , int height ) { bBuf . rewind ( ) ; byte [ ] scanLine0 = new byte [ width ] ; byte [ ] scanLine1 = new byte [ width ] ; for ( int h = 0 ; h < height / 2 ; ++ h ) { bBuf . position ( h * width ) ; bBuf . get ( scanLine0 , 0 , width ) ; bBuf . position ( ( height - h - 1 ) * width ) ; bBuf . get ( scanLine1 , 0 , width ) ; bBuf . position ( ( height - h - 1 ) * width ) ; bBuf . put ( scanLine0 , 0 , width ) ; bBuf . position ( h * width ) ; bBuf . put ( scanLine1 , 0 , width ) ; } bBuf . rewind ( ) ; }
target:  Flip an image buffer on the Y axis.