private String formatNode(SegmentTreeNode<?> node){
  StringBuilder response=new StringBuilder("(");
  if (node.lson != null) {
    response.append(formatNode(node.lson));
  }
  response.append(node.toString());
  if (node.rson != null) {
    response.append(formatNode(node.rson));
  }
  response.append(")");
  return response.toString();
}

private String formatNode ( SegmentTreeNode < ? > node ) { StringBuilder response = new StringBuilder ( "(" ) ; if ( node . lson != null ) { response . append ( formatNode ( node . lson ) ) ; } response . append ( node . toString ( ) ) ; if ( node . rson != null ) { response . append ( formatNode ( node . rson ) ) ; } response . append ( ")" ) ; return response . toString ( ) ; }
format the node , recursively .
