public static void appendFlagsAsChars(final short flags, final Appendable appendable)
    {
        final int length = 8;
        short mask = (short)(1 << (length - 1));

        try
        {
            for (int i = 0; i < length; i++)
            {
                appendable.append((flags & mask) == mask ? '1' : '0');
                mask >>= 1;
            }
        }
        catch (final IOException ex)
        {
            LangUtil.rethrowUnchecked(ex);
        }
    }
@Test
    void shouldAppendFlags()
    {
        final short flags = 0b01100000;
        final StringBuilder builder = new StringBuilder();

        HeaderFlyweight.appendFlagsAsChars(flags, builder);
        assertEquals("01100000", builder.toString());
    }