Here you can find the source of getStackTrace(final Throwable e)
public static String getStackTrace(final Throwable e)
//package com.java2s; /*//from w w w . j a va 2s .c o m * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ import java.io.PrintWriter; import java.io.StringWriter; public class Main { /** * Gets the stack trace of exception as string */ public static String getStackTrace(final Throwable e) { final StringWriter s = new StringWriter(); e.printStackTrace(new PrintWriter(s)); return s.toString(); } public static String toString(final boolean[] array) { String result = "["; for (int i = 0; i < array.length; i++) { if (i > 0) { result += ", "; } result += array[i]; } return result + "]"; } public static String toString(final int[] array) { String result = "["; for (int i = 0; i < array.length; i++) { if (i > 0) { result += ", "; } result += array[i]; } return result + "]"; } }