package debugging;

import java.io.StringWriter;
import java.io.PrintWriter;

public class Debug {

	public static final boolean DEBUG = false;

	private static final String DEBUG_PREFIX = "[DEBUG] ";

	public static void debug(Object o) {
		if (DEBUG) {
			System.err.print(DEBUG_PREFIX + o);
		}
	}

	public static void debugln(Object o) {
		if (DEBUG) {
			System.err.println(DEBUG_PREFIX + o);
		}
	}

	public static void debugStackTrace(Exception e) {
		if (DEBUG) {
			StringWriter stringWriter = new StringWriter();
			PrintWriter printWriter = new PrintWriter(stringWriter);
			e.printStackTrace(printWriter);
			String stackTraceStr = stringWriter.toString();

			String stackTraceDebugStr = stackTraceStr.replaceAll("\n", "\n" + DEBUG_PREFIX);
			System.err.println(stackTraceDebugStr);
		}
	}
	
}

@@ -71,16 +71,87 @@
 riter;%0A%0A
+/**%0A * A class for debugging functions.%0A * @author N. H. Weideman%0A */%0A%0A
 public c

Update Debug.java