Here you can find the source of printStackTrace(String header, int depth)
public static void printStackTrace(String header, int depth)
//package com.java2s; public class Main { public static void printStackTrace(String header, int depth) { System.out.println(header); int i = 0; for (StackTraceElement se : Thread.currentThread().getStackTrace()) { System.out.println(se); if (i++ > depth) { break; }/*from ww w .j av a2 s .c om*/ } } }