@NotNull public static String normalize(@NotNull String path){
  int start=0;
  boolean separator=false;
  if (SystemInfo.isWindows) {
    if (path.startsWith("//")) {
      start=2;
      separator=true;
    }
 else     if (path.startsWith("\\\\")) {
      return normalizeTail(0,path,false);
    }
  }
  for (int i=start; i < path.length(); ++i) {
    final char c=path.charAt(i);
    if (c == '/') {
      if (separator) {
        return normalizeTail(i,path,true);
      }
      separator=true;
    }
 else     if (c == '\\') {
      return normalizeTail(i,path,separator);
    }
 else {
      separator=false;
    }
  }
  return path;
}

@ NotNull public static String normalize ( @ NotNull String path ) { int start = 0 ; boolean separator = false ; if ( SystemInfo . isWindows ) { if ( path . startsWith ( "//" ) ) { start = 2 ; separator = true ; } else if ( path . startsWith ( "\\\\" ) ) { return normalizeTail ( 0 , path , false ) ; } } for ( int i = start ; i < path . length ( ) ; ++ i ) { final char c = path . charAt ( i ) ; if ( c == '/' ) { if ( separator ) { return normalizeTail ( i , path , true ) ; } separator = true ; } else if ( c == '\\' ) { return normalizeTail ( i , path , separator ) ; } else { separator = false ; } } return path ; }
converts back slashes to forward slashes removes double slashes inside the path , e . g . " x / y / / z " = > " x / y / z "
