### Question:
ReflectionUtil { public static String describeMethodInSortFriendlyWay(Method theMethod) { StringBuilder b = new StringBuilder(); b.append(theMethod.getName()); b.append(" returns("); b.append(theMethod.getReturnType().getName()); b.append(") params("); Class<?>[] parameterTypes = theMethod.getParameterTypes(); for (int i = 0, parameterTypesLength = parameterTypes.length; i < parameterTypesLength; i++) { if (i > 0) { b.append(", "); } Class<?> next = parameterTypes[i]; b.append(next.getName()); } b.append(")"); return b.toString(); }  static List<Method> getDeclaredMethods(Class<?> theClazz); static String describeMethodInSortFriendlyWay(Method theMethod); static Class<?> getGenericCollectionTypeOfField(Field next); static Class<?> getGenericCollectionTypeOfFieldWithSecondOrderForList(Field next); static Class<?> getGenericCollectionTypeOfMethodParameter(Method theMethod, int theParamIndex); static Class<?> getGenericCollectionTypeOfMethodReturnType(Method theMethod); static boolean isInstantiable(Class<?> theType); static T newInstance(Class<T> theType); static T newInstance(Class<T> theType, Class<?> theArgumentType, Object theArgument); static Object newInstanceOfFhirServerType(String theType); static T newInstanceOrReturnNull(String theClassName, Class<T> theType); @SuppressWarnings("unchecked") static T newInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs); static boolean typeExists(String theName); static final Object[] EMPTY_OBJECT_ARRAY; static final Class<?>[] EMPTY_CLASS_ARRAY; }### Answer:
@Test public void testDescribeMethod() throws NoSuchMethodException { Method method = String.class.getMethod("startsWith", String.class, int.class); String description = ReflectionUtil.describeMethodInSortFriendlyWay(method); assertEquals("startsWith returns(boolean) params(java.lang.String, int)", description); }