@Override
        public void formatTo(Formatter formatter, int flags, int width, int precision) {
            final boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;
            StringBuilder buffer = new StringBuilder(width);
            int count = 0;
            for (int i = 0; i < length; i++) {
                final int index = leftJustify ? i : length - 1 - i;
                char c = chars[index];
                if (leftJustify) {
                    buffer.append(c);
                } else {
                    buffer.insert(0, c);
                }
                final int w = getWidth(c);
                if (++count >= width) {
                    if (w == 2) {
                        buffer.setCharAt(index, SPACE);
                    }
                    break;
                }
                if (w == 2) {
                    ++count;
                }
            }
            if (count < width) {
                char[] chars = new char[width - count];
                Arrays.fill(chars, SPACE);
                if (leftJustify) {
                    buffer.append(chars);
                } else {
                    buffer.insert(0, chars);
                }
            }
            formatter.format(buffer.toString());
        }