TextUtils { public static String ellipsizeBeginning(String text) { return text.length() <= 100 ? text : "..." + text.substring(text.length() - 97, text.length()); } private  TextUtils(); static CharSequence textToHtml(String text); static String ellipsizeBeginning(String text); static String join(@NonNull CharSequence delimiter, @NonNull Iterable tokens);  }
@Test public void ellipsizeBeginningTest() { assertEquals("Lorem ipsum dolor sit amet, consectetur massa nunc", TextUtils.ellipsizeBeginning("Lorem ipsum dolor sit amet, consectetur massa nunc")); assertEquals("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer tempus, risus ac cursus turpis duis", TextUtils.ellipsizeBeginning("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer tempus, risus ac cursus turpis duis")); assertEquals("...m ipsum dolor sit amet, consectetur adipiscing elit. Cras finibus, augue a imperdiet orci aliquam", TextUtils.ellipsizeBeginning("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras finibus, augue a imperdiet orci aliquam")); assertEquals("...it. Donec cursus condimentum sagittis. Ut condimentum efficitur libero, vitae volutpat dui nullam", TextUtils.ellipsizeBeginning("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus condimentum sagittis. Ut condimentum efficitur libero, vitae volutpat dui nullam")); }