Presumably b3[i] is never equal to the digit '1' (which does not have a value of 1, BTW, just as '0' and 0 are non-equal). That means z will never be set to zero.