class PathUtils {

    public static String removeLeadingFragments(String path, String separator, int nbFragments) {
        path = removeLeadingSeparator(path, separator);

        if(nbFragments==0)
            return path;

        int pos=-1;
        for(int i=0; i<nbFragments && (pos=path.indexOf(separator, pos+1))!=-1; i++);

        if(pos==-1 || pos==path.length()-1)
            return "";

        return path.substring(pos+1);
    }

}