public Bits bitwiseXor ( final Bits right ) { final int lengthDifference = this . bitLength - right . bitLength ; if ( lengthDifference < 0 ) { return this . concatenate ( new Bits ( 0l , - lengthDifference ) ) . bitwiseXor ( right ) ; } if ( lengthDifference > 0 ) { return this . bitwiseXor ( right . concatenate ( new Bits ( 0l , lengthDifference ) ) ) ; } final Bits returnValue = new Bits ( new byte [ this . bytes . length ] , this . bitLength ) ; for ( int i = 0 ; i < this . bytes . length ; i ++ ) { returnValue . bytes [ i ] = this . bytes [ i ] ; } for ( int i = 0 ; i < right . bytes . length ; i ++ ) { returnValue . bytes [ i ] ^= right . bytes [ i ] ; } return returnValue ; }
Bitwise xor bits .