Java tutorial
//package com.java2s; import java.lang.reflect.Constructor; import java.lang.reflect.Method; public class Main { public static String parseParameterTypes(Method method) { String parameterTypes = ""; for (Class<?> parameterClass : method.getParameterTypes()) parameterTypes += parseClassType(parameterClass); return parameterTypes; } public static String parseParameterTypes(Constructor<?> constructor) { String parameterTypes = ""; for (Class<?> parameterClass : constructor.getParameterTypes()) parameterTypes += parseClassType(parameterClass); return parameterTypes; } public static String parseClassType(Class<?> classInst) { String classType = ""; String className = classInst.getName(); // Primitive type if (className.equals("void")) classType = "V"; else if (className.equals("byte")) classType = "B"; else if (className.equals("short")) classType = "S"; else if (className.equals("int")) classType = "I"; else if (className.equals("long")) classType = "L"; else if (className.equals("float")) classType = "F"; else if (className.equals("double")) classType = "D"; else if (className.equals("char")) classType = "C"; else if (className.equals("boolean")) classType = "Z"; // Class type else if (className.indexOf(".") != -1) { classType = className.replace(".", "/"); if (className.indexOf(";") == -1) classType = classType + ";"; if (className.indexOf("L") == -1) classType = "L" + classType; } else classType = className; return classType; } }