private byte [ ] getFlagBytes ( ) { byte [ ] b = new byte [ numFlagBytes ] ; int bytesCopied = 1 ; b [ 0 ] = 0 ; if ( update ) { b [ 0 ] |= 0x80 ; b [ bytesCopied ++ ] = 0 ; } if ( crced ) { b [ 0 ] |= 0x40 ; b [ bytesCopied ++ ] = ( byte ) crc . length ; System . arraycopy ( crc , 0 , b , bytesCopied , crc . length ) ; bytesCopied += crc . length ; } if ( ( maxTagSize != - 1 ) || textEncode || ( maxTextSize != - 1 ) || imageEncode || ( imageRestrict != - 1 ) ) { b [ 0 ] |= 0x20 ; b [ bytesCopied ++ ] = 0x01 ; byte restrict = 0 ; if ( maxTagSize != - 1 ) restrict |= ( byte ) ( ( maxTagSize & 0x3 ) << 6 ) ; if ( textEncode ) restrict |= 0x20 ; if ( maxTextSize != - 1 ) restrict |= ( byte ) ( ( maxTextSize & 0x3 ) << 3 ) ; if ( imageEncode ) restrict |= 0x04 ; if ( imageRestrict != - 1 ) restrict |= ( byte ) ( imageRestrict & 0x3 ) ; b [ bytesCopied ++ ] = restrict ; } return b ; }
A helper function for the getBytes method that returns a byte array representing the extended flags field of the extended header .