Here you can find the source of dumpStack(final PrintStream out, final int skip, final int depth)
public static void dumpStack(final PrintStream out, final int skip, final int depth)
//package com.java2s; import java.io.PrintStream; public class Main { public static void dumpStack(final PrintStream out) { dumpStack(out, 1, -1);//from w w w .java 2 s.c o m } public static void dumpStack(final PrintStream out, final int skip, final int depth) { dumpStack(out, new Exception(""), skip + 1, depth); } public static void dumpStack(final PrintStream out, final Throwable t, final int skip, final int depth) { dumpStack(out, t.getStackTrace(), skip, depth); } public static void dumpStack(final PrintStream out, final StackTraceElement[] stack, final int skip, final int depth) { if (null == stack) { return; } final int maxDepth; if (0 > depth) { maxDepth = stack.length; } else { maxDepth = Math.min(depth + skip, stack.length); } for (int i = skip; i < maxDepth; i++) { out.println(" [" + i + "]: " + stack[i]); } } }