code: public static boolean isSibling(String p1, String p2)
     {
        int pos1 = p1.lastIndexOf('/');
        int pos2 = p2.lastIndexOf('/');
        return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
     }
docs: Determines, if two paths denote hierarchical siblins.
  
  @param p1
  first path
  @param p2
  second path
  @return true if on same level, false otherwise