Oops... three cases where the comment does not hold. At minimum, it might be
appropriate to spin based on case 3's min/avg/max length.
if ( b1 == b2 ) {
return true;
}
if ( b1 == null || b2 == null ) {
return (b1 == b2);
}
if ( b1.length != b2.length ) {
return false;
}
int result = 0;
// Make sure to go through ALL the bytes. We use the fact that if
// you XOR any bit stream with itself the result will be all 0 bits,
// which in turn yields 0 for the result.
for(int i = 0; i < b1.length; i++) {
// XOR the 2 current bytes and then OR with the outstanding result.
result |= (b1[i] ^ b2[i]);
}
return (result == 0) ? true : false;
Original issue reported on code.google.com by noloa...@gmail.com on 6 Aug 2011 at 8:54
Original issue reported on code.google.com by
noloa...@gmail.com
on 6 Aug 2011 at 8:54