TextFormatter { public static StringBuilder elapsed(long elapsedNanos) { final StringBuilder buf = new StringBuilder(16); appendElapsed(buf, elapsedNanos); return buf; } private  TextFormatter(); static StringBuilder elapsed(long elapsedNanos); static StringBuilder elapsed(long startTimeNanos, long endTimeNanos); static void appendElapsed(StringBuilder buf, long elapsedNanos); static void appendElapsed(StringBuilder buf, long startTimeNanos, long endTimeNanos); static StringBuilder size(long size); static void appendSize(StringBuilder buf, long size); static StringBuilder elapsedAndSize(long startTimeNanos, long endTimeNanos, long size); static void appendElapsedAndSize(
            StringBuilder buf, long startTimeNanos, long endTimeNanos, long size); static StringBuilder epochMillis(long timeMillis); static void appendEpochMillis(StringBuilder buf, long timeMillis); static StringBuilder epochMicros(long timeMicros); static void appendEpochMicros(StringBuilder buf, long timeMicros); static StringBuilder socketAddress(@Nullable SocketAddress addr); static void appendSocketAddress(StringBuilder buf, @Nullable SocketAddress addr); static StringBuilder inetAddress(@Nullable InetAddress addr); static void appendInetAddress(StringBuilder buf, @Nullable InetAddress addr);  }
@Test void elapsed() throws Exception { assertThat(TextFormatter.elapsed(1, 100).toString()).isEqualTo("99ns"); assertThat(TextFormatter.elapsed(TimeUnit.MICROSECONDS.toNanos(100) + 1).toString()) .isEqualTo("100\u00B5s(100001ns)"); assertThat(TextFormatter.elapsed(TimeUnit.MILLISECONDS.toNanos(100) + 1).toString()) .isEqualTo("100ms(100000001ns)"); assertThat(TextFormatter.elapsed(TimeUnit.SECONDS.toNanos(100) + 1).toString()) .isEqualTo("100s(100000000001ns)"); }