src/main/java/org/plumelib/bcelutil/BcelUtil.java
public static String methodDeclarationToString(Method m) {

    StringBuilder sb = new StringBuilder();
    String flags = accessFlagsToString(m);
    boolean argsExist = false;
    if (flags != null && !flags.isEmpty()) {
      sb.append(String.format("%s ", flags));
    }
    sb.append(String.format("%s %s(", m.getReturnType(), m.getName()));
    for (Type at : m.getArgumentTypes()) {
      sb.append(String.format("%s, ", at));
      argsExist = true;
    }
    if (argsExist) {
      sb.setLength(sb.length() - 2); // remove trailing ", "
    }
    sb.append(")");
    return sb.toString();
  }
public static String methodDeclarationToString(Method m) {

    StringBuilder sb = new StringBuilder();
    String flags = accessFlagsToString(m);
    boolean argsExist = false;
    if (flags != null && !flags.isEmpty()) {
      sb.append(String.format("%s ", flags));
    }
    sb.append(String.format("%s %s(", m.getReturnType(), m.getName()));
    for (Type at : m.getArgumentTypes()) {
      sb.append(String.format("%s, ", at));
      argsExist = true;
    }
    if (argsExist) {
      sb.setLength(sb.length() - 2); // remove trailing ", "
    }
    sb.append(")");
    return sb.toString();
  }
Returns a string describing a method declaration. It contains the access flags (public,
private, static, etc), the return type, the method name, and the types of each of its
parameters.

<p>For example, if the orignal Java source declarationwas: private final String
constantToString (int index) Then the output of methodDeclarationToString would be: private
final java.lang.String constantToString (int)

@param m the method
@return a string describing the method declaration