Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String convertStackTraceToString(StackTraceElement[] stackTraceElements) {
        StringBuilder message = new StringBuilder();
        int min = Math.min(stackTraceElements.length, 4);
        for (int i = 2; i < min; i++) {
            StackTraceElement element = stackTraceElements[i];
            message.append(element.getClassName()).append(": ").append(element.getMethodName()).append("\n");
        }
        return message.toString();
    }
}