paths = [
"nodeA1",
"nodeA1/nodeB1/nodeC1",
"nodeA1/nodeB1/nodeC1/nodeD1/nodeE1",
"nodeA1/nodeB1/nodeC2",
"nodeA1/nodeB2/nodeC2",
"nodeA3/nodeB2/nodeC3"
]


you have list of strings there. how can i create a tree by system.out.println from all those paths.

nodea1
----nodeb1
-----------nodec1
-------------------noded1
------------------------------nodee1
-----------nodec2
-----nodeb2
-----------nodec2
nodea3
-------nodeb2
------------nodec3



alogrithm am trying

package project2;
 
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
 
public class Exercise {
    String krikor = "lolig";
 
    public Exercise() {
 
        List<Node> nodelist = new ArrayList();
        String[] jo = new String[4];
        jo[0] = "Elie>2>4";
        jo[1] = "Elie>3>1>2";
        jo[2] = "Krikor>Elie>7";
        jo[3] = "Krikor>10";
        int f = jo.length;
        int p = 0;
        while (p < f) {
            String[] split = jo[p].split(">");
            int x = split.length;
            int m = 0;
            while (m < x) {
                System.out.println(split[m]);
                m = m + 1;
                // here I will add each value into arraylist of nodes.and i will add their children as well.and their level
 
            }
            p = p + 1;
        }
 
 
    }
 
    public void setKrikor(String krikor) {
        this.krikor = krikor;
    }
 
    public String getKrikor() {
        return krikor;
    }
}

package project2;
 
import java.util.ArrayList;
import java.util.List;
 
public class Node {
    String name;
    int level;
    public ArrayList<Node> childs = new ArrayList<Node>();
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getName() {
        return name;
    }
 
    public void setChilds(ArrayList<Node> childs) {
        this.childs = childs;
    }
 
    public ArrayList<Node> getChilds() {
        return childs;
    }
 
    public void setLevel(int level) {
        this.level = level;
    }
 
    public int getLevel() {
        return level;
    }
}


this is best i can go for. anyone with big help?