Here you can find the source of printStackTrace(Exception e)
public static String printStackTrace(Exception e)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String printStackTrace(Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return sw.toString(); }//from www . j a va 2 s . c o m }