Merge "Fix a bug in BitOutputStream where any trailing zeros will be discarded along with an optimization to avoid maintaining two copies of data in memory during toByteArray."