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 getStack() {
        StackTraceElement astacktraceelement[] = (new Throwable()).getStackTrace();
        String s;
        if (astacktraceelement == null || astacktraceelement.length < 2) {
            s = "";
        } else {
            s = "";
            int i = 1;
            while (i < astacktraceelement.length
                    && astacktraceelement[i].getClassName().contains("com.tencent.mm")) {
                s = (new StringBuilder()).append(s).append("[")
                        .append(astacktraceelement[i].getClassName().substring(15)).append(":")
                        .append(astacktraceelement[i].getMethodName()).append("]").toString();
                i++;
            }
        }
        return s;
    }
}