question: public float computeEdgeFill ( ) { if ( dataType != DataType . Float ) { throw new IllegalStateException ( "Must be a float raster." ) ; } byte [ ] bArray1 = new byte [ width * numBytes ] ; ByteBuffer bBuf1 = ByteBuffer . wrap ( bArray1 ) ; bBuf1 . rewind ( ) ; FloatBuffer fBuf1 = bBuf1 . asFloatBuffer ( ) ; byte [ ] bArray2 = new byte [ width * numBytes ] ; ByteBuffer bBuf2 = ByteBuffer . wrap ( bArray2 ) ; bBuf2 . rewind ( ) ; FloatBuffer fBuf2 = bBuf2 . asFloatBuffer ( ) ; float zMin = Float . MAX_VALUE ; for ( int r = 0 ; r < length ; ++ r ) { mmbBuf . get ( r , bBuf1 . array ( ) ) ; fBuf1 . rewind ( ) ; for ( int c = 0 ; c < width ; ++ c ) { float val = fBuf1 . get ( c ) ; if ( ! Float . isNaN ( val ) ) { zMin = Math . min ( zMin , val ) ; break ; } } for ( int c = width - 1 ; c >= 0 ; c -- ) { float val = fBuf1 . get ( c ) ; if ( ! Float . isNaN ( val ) ) { zMin = Math . min ( zMin , val ) ; break ; } } } boolean found = false ; mmbBuf . get ( 0 , bBuf1 . array ( ) ) ; fBuf1 . rewind ( ) ; for ( int r = 1 ; r < length ; ++ r ) { boolean done = true ; mmbBuf . get ( r , bBuf2 . array ( ) ) ; fBuf2 . rewind ( ) ; for ( int c = 0 ; c < width ; ++ c ) { float val1 = fBuf1 . get ( c ) ; float val2 = fBuf2 . get ( c ) ; if ( Float . isNaN ( val1 ) ) { if ( ! Float . isNaN ( val2 ) ) { zMin = Math . min ( zMin , val2 ) ; done = false ; found = true ; } } else { found = true ; if ( Float . isNaN ( val2 ) ) { done = false ; } } } fBuf2 . rewind ( ) ; FloatBuffer tmp = fBuf1 ; fBuf1 = fBuf2 ; fBuf2 = tmp ; if ( found && done ) { break ; } } found = false ; mmbBuf . get ( length - 1 , bBuf1 . array ( ) ) ; fBuf1 . rewind ( ) ; for ( int r = ( length - 2 ) ; r >= 0 ; r -- ) { boolean done = true ; mmbBuf . get ( r , bBuf2 . array ( ) ) ; fBuf2 . rewind ( ) ; for ( int c = 0 ; c < width ; ++ c ) { float val1 = fBuf1 . get ( c ) ; float val2 = fBuf2 . get ( c ) ; if ( Float . isNaN ( val1 ) ) { if ( ! Float . isNaN ( val2 ) ) { zMin = Math . min ( zMin , val2 ) ; done = false ; found = true ; } } else { found = true ; if ( Float . isNaN ( val2 ) ) { done = false ; } } } fBuf2 . rewind ( ) ; FloatBuffer tmp = fBuf1 ; fBuf1 = fBuf2 ; fBuf2 = tmp ; if ( found && done ) { break ; } } return ( zMin ) ; }
target:  Determine the value used to fill to the edge of the raster.