Java tutorial
//package com.java2s; import java.lang.reflect.Method; public class Main { public static long generateCodeOfMethod(Class<?> providerClass, Method method) { StringBuilder buider = new StringBuilder(method.getName()); long classCode = providerClass.getName().hashCode(); Class<?>[] paramTypes = method.getParameterTypes(); for (Class<?> c : paramTypes) { buider.append(c.getName()); } return classCode << 32 + buider.toString().hashCode(); } }