Util { public static String reverseEndian(String in) { in = (in.length() % 2 != 0) ? "0" + in : in; StringBuilder sb = new StringBuilder(); for (int i = in.length() - 2; i >= 0; i += (i % 2 == 0) ? 1 : -3) { sb.append(in.charAt(i)); } return sb.toString(); } private  Util(); static String generateUUID(); static String generateDbUUID(); static Set<T> asSet(T... values); static Date tomorrow(); static Date yesterday(); static Date midnight(); static Date addDaysToDt(int dayField); static Date addMinutesToDt(int minuteField); static Date toDate(String dt); static T assertNotNull(T value, String message); static boolean equals(String str, String str1); static void closeSafely(Object closable, String msg); static String capitalize(String str); static long generateUniqueLong(); static String toBase64(byte[] data); static SimpleDateFormat getUTCDateFormat(); static String readFile(InputStream is); static String hash(String password); static String toJson(Object anObject); static T fromJson(String json, Class<T> clazz); @SuppressWarnings("rawtypes") static String getClassName(Class c); static String getClassName(String fullClassName); static String reverseEndian(String in); static String transformUuid(String uuid); static List<String> getPossibleUuids(String... ids); static boolean isUuid(String uuid); static String collectionToString(Collection c); static boolean collectionsAreEqual(Collection<T> c1, Collection<T> c2); static boolean collectionsAreEqual(Collection<T> c1, Collection<T> c2, Comparator<T> comp); static String getHostname(); static final String UTC_STR; }
@Test public void testReverseEndian() { assertEquals("3412", Util.reverseEndian("1234")); assertEquals("2301", Util.reverseEndian("123")); assertEquals("12", Util.reverseEndian("12")); assertEquals("01", Util.reverseEndian("1")); assertEquals("", Util.reverseEndian("")); }