@SuppressWarnings("checkstyle:magicnumber")
    void writeLong(long value) {
        if (value == Long.MIN_VALUE) {
            write(STR_LONG_MIN_VALUE);
            return;
        }

        if (value < 0) {
            write('-');
            value = -value;
        }

        int digitsWithoutComma = 0;
        tmpSb.setLength(0);
        do {
            digitsWithoutComma++;
            if (digitsWithoutComma == 4) {
                tmpSb.append(',');
                digitsWithoutComma = 1;
            }

            int mod = (int) (value % 10);
            tmpSb.append(DIGITS[mod]);
            value = value / 10;
        } while (value > 0);

        for (int k = tmpSb.length() - 1; k >= 0; k--) {
            char c = tmpSb.charAt(k);
            write(c);
        }
    }
@Test
    public void writeLong() {
        assertLongValue(0);
        assertLongValue(10);
        assertLongValue(100);
        assertLongValue(1000);
        assertLongValue(10000);
        assertLongValue(100000);
        assertLongValue(1000000);
        assertLongValue(10000000);
        assertLongValue(100000000);
        assertLongValue(1000000000);
        assertLongValue(10000000000L);
        assertLongValue(100000000000L);
        assertLongValue(1000000000000L);
        assertLongValue(10000000000000L);
        assertLongValue(100000000000000L);
        assertLongValue(1000000000000000L);
        assertLongValue(10000000000000000L);
        assertLongValue(100000000000000000L);
        assertLongValue(1000000000000000000L);

        assertLongValue(-10);
        assertLongValue(-100);
        assertLongValue(-1000);
        assertLongValue(-10000);
        assertLongValue(-100000);
        assertLongValue(-1000000);
        assertLongValue(-10000000);
        assertLongValue(-100000000);
        assertLongValue(-1000000000);
        assertLongValue(-10000000000L);
        assertLongValue(-100000000000L);
        assertLongValue(-1000000000000L);
        assertLongValue(-10000000000000L);
        assertLongValue(-100000000000000L);
        assertLongValue(-1000000000000000L);
        assertLongValue(-10000000000000000L);
        assertLongValue(-100000000000000000L);
        assertLongValue(-1000000000000000000L);

        assertLongValue(1);
        assertLongValue(345);
        assertLongValue(83883);
        assertLongValue(1222333);
        assertLongValue(11122233);
        assertLongValue(111222334);
        assertLongValue(1112223344);

        assertLongValue(-1);
        assertLongValue(-345);
        assertLongValue(-83883);
        assertLongValue(-1222333);
        assertLongValue(-11122233);
        assertLongValue(-111222334);
        assertLongValue(-1112223344);

        assertLongValue(Integer.MIN_VALUE);
        assertLongValue(Integer.MAX_VALUE);
        assertLongValue(Long.MIN_VALUE);
        assertLongValue(Long.MAX_VALUE);
    }