private static String basename(String str){
  int sl=str.lastIndexOf('/');
  if (sl >= 0) {
    return str.substring(sl + 1);
  }
  return str;
}

private static String basename ( String str ) { int sl = str . lastIndexOf ( '/' ) ; if ( sl >= 0 ) { return str . substring ( sl + 1 ) ; } return str ; }
gets the last element ( i . e . the file name ) from the given path
