int count = 1;
int count = path.length() > 0 ? 1 : 0;
    public static int getSegmentsCount(String path) {        int count = 1;        // skipe first char, then count number of '/'        for(int i = 1; i < path.length(); i++) {            if (path.charAt(i) == '/') {                count++;            }        }        return count;    }