question: static byte [ ] discardNonBase64 ( byte [ ] data ) { byte groomedData [ ] = new byte [ data . length ] ; int bytesCopied = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( isBase64 ( data [ i ] ) ) { groomedData [ bytesCopied ++ ] = data [ i ] ; } } byte packedData [ ] = new byte [ bytesCopied ] ; System . arraycopy ( groomedData , 0 , packedData , 0 , bytesCopied ) ; return packedData ; }
target:  Discards any characters outside of the base64 alphabet, per the requirements on page 25 of RFC 2045 - "Any characters outside of the base64 alphabet are to be ignored in base64 encoded data."