question: public String canonizeString ( String file ) { int i = 0 ; int lim = file . length ( ) ; while ( ( i = file . indexOf ( "/../" ) ) >= 0 ) { if ( ( lim = file . lastIndexOf ( '/' , i - 1 ) ) >= 0 ) { file = file . substring ( 0 , lim ) + file . substring ( i + 3 ) ; } else { file = file . substring ( i + 3 ) ; } } while ( ( i = file . indexOf ( "/./" ) ) >= 0 ) { file = file . substring ( 0 , i ) + file . substring ( i + 2 ) ; } while ( file . endsWith ( "/.." ) ) { i = file . indexOf ( "/.." ) ; if ( ( lim = file . lastIndexOf ( '/' , i - 1 ) ) >= 0 ) { file = file . substring ( 0 , lim + 1 ) ; } else { file = file . substring ( 0 , i ) ; } } if ( file . endsWith ( "/." ) ) file = file . substring ( 0 , file . length ( ) - 1 ) ; return file ; }
target:  Returns a canonical version of the specified string.