Here you can find the source of printStackTrace(StackTraceElement[] stackTrace)
public static String printStackTrace(StackTraceElement[] stackTrace)
//package com.java2s; //License from project: Apache License public class Main { public static String printStackTrace(StackTraceElement[] stackTrace) { StringBuilder sb = new StringBuilder(); for (StackTraceElement s : stackTrace) { sb.append(s.toString());/*from ww w.j a va2 s . c o m*/ sb.append("\n"); } return sb.toString(); } }