private static String printCommentTree(CommentTreeElement c, int level) {
        
        // Initialize empty buffer
        StringBuilder builder = new StringBuilder();
        
        // Add tabulation
        for (int i = 0; i < level; i++) {
            builder.append("\t");
        }
        
        // Comment string
        builder.append(c.toString());
        builder.append("\n");
        
        // Iterate over children
        if (c instanceof Comment) {
            for (CommentTreeElement child : ((Comment) c).getReplies()) {
                builder.append(printCommentTree(child, level + 1));
            }
        }
        
        // Return the buffer
        return builder.toString();
        
    }
private static String printCommentTree(CommentTreeElement c, int level) {
        
        
        StringBuilder builder = new StringBuilder();
        
        
        for (int i = 0; i < level; i++) {
            builder.append("\t");
        }
        
        
        builder.append(c.toString());
        builder.append("\n");
        
        
        if (c instanceof Comment) {
            for (CommentTreeElement child : ((Comment) c).getReplies()) {
                builder.append(printCommentTree(child, level + 1));
            }
        }
        
        
        return builder.toString();
        
    }
private static String printCommentTree ( CommentTreeElement c , int level ) { // Initialize empty buffer StringBuilder builder = new StringBuilder ( ) ; // Add tabulation for ( int i = 0 ; i < level ; i ++ ) { builder . append ( "\t" ) ; } // Comment string builder . append ( c . toString ( ) ) ; builder . append ( "\n" ) ; // Iterate over children if ( c instanceof Comment ) { for ( CommentTreeElement child : ( ( Comment ) c ) . getReplies ( ) ) { builder . append ( printCommentTree ( child , level + 1 ) ) ; } } // Return the buffer return builder . toString ( ) ; }
Get printable version of a comment at a specific level.<br>
<br>
<i>Note: uses unsafe recursion</i>

@param c            Comment
@param level        Level to place at

@return Printable comment tree
Get printable version of a comment at a specific level . <br > <br > <i > Note : uses unsafe recursion< / i >