Here you can find the source of getMethodName(final int depth)
public static String getMethodName(final int depth)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { private static Method m; public static String getMethodName(final int depth) { try {/*from www . ja v a2 s. c o m*/ StackTraceElement element = (StackTraceElement) m.invoke(new Throwable(), depth + 1); return element.getMethodName(); } catch (Exception e) { e.printStackTrace(); return null; } } }