@Override public boolean equals(Object obj) {
        if (!(obj instanceof HyperLogLogPlus)) {
            return false;
        }
        HyperLogLogPlus other = (HyperLogLogPlus) obj;
        if (format == Format.SPARSE) {
            mergeTempList();
        }
        if (other.format == Format.SPARSE) {
            other.mergeTempList();
        }
        if (other.format != format) {
            return false;
        }
        if (format == Format.NORMAL) {
            return Arrays.equals(registerSet.readOnlyBits(), other.registerSet.readOnlyBits());
        } else {
            return Arrays.equals(sparseSet, other.sparseSet);
        }
    }
@Test
    public void testEquals() {
        HyperLogLogPlus hll1 = new HyperLogLogPlus(5, 25);
        HyperLogLogPlus hll2 = new HyperLogLogPlus(5, 25);
        hll1.offer("A");
        hll2.offer("A");
        assertEquals(hll1, hll2);
        hll2.offer("B");
        hll2.offer("C");
        hll2.offer("D");
        assertNotEquals(hll1, hll2);
        HyperLogLogPlus hll3 = new HyperLogLogPlus(5, 25);
        for (int i = 0; i < 50000; i++) {
            hll3.offer("" + i);
        }
        assertNotEquals(hll1, hll3);
    }