AppendableUtils { public static void appendUnsignedString(final StringBuilder sb, final long nr, final int shift) { long i = nr; char[] buf = BUFF.get(); int charPos = 64; int radix = 1 << shift; long mask = radix - 1; do { buf[--charPos] = DIGITS[(int) (i & mask)]; i >>>= shift; } while (i != 0); sb.append(buf, charPos, 64 - charPos); } private  AppendableUtils(); static void escapeJsonString(@Nonnull final CharSequence toEscape, final StringBuilder jsonString); static void escapeJsonString(@Nonnull final CharSequence toEscape, final Appendable jsonString); static void appendJsonStringEscapedChar(final char c, final StringBuilder jsonString); static void appendJsonStringEscapedChar(final char c, final Appendable jsonString); static void appendUnsignedStringPadded(final StringBuilder sb, final int nr, final int shift,
          final int padTo); static void appendUnsignedStringPadded(final Appendable sb, final int nr, final int shift,
          final int padTo); static void appendUnsignedString(final StringBuilder sb, final long nr, final int shift); static void appendUnsignedString(final StringBuilder sb, final int nr, final int shift); static void appendSpaces(final Appendable to, final int nrSpaces); static void appendSpaces(final StringBuilder to, final int nrSpaces);  }
@Test public void testAppendable() { StringBuilder sb = new StringBuilder(); AppendableUtils.appendUnsignedString(sb, 13, 5); Assert.assertEquals(13, Integer.parseUnsignedInt(sb.toString(), 32)); }
@Test public void testAppendable2() { StringBuilder sb = new StringBuilder(); AppendableUtils.appendUnsignedString(sb, 26, 5); Assert.assertEquals(26, Integer.parseUnsignedInt(sb.toString(), 32)); }
@Test public void testAppendable3() { StringBuilder sb = new StringBuilder(); AppendableUtils.appendUnsignedString(sb, 1045, 5); Assert.assertEquals(1045, Integer.parseUnsignedInt(sb.toString(), 32)); }