public static String removeFileExtension(String s){
  String separator=System.getProperty("file.separator");
  String filename;
  int lastSeparatorIndex=s.lastIndexOf(separator);
  if (lastSeparatorIndex == -1) {
    filename=s;
  }
 else {
    filename=s.substring(lastSeparatorIndex + 1);
  }
  return filename;
}

public static String removeFileExtension ( String s ) { String separator = System . getProperty ( "file.separator" ) ; String filename ; int lastSeparatorIndex = s . lastIndexOf ( separator ) ; if ( lastSeparatorIndex == - 1 ) { filename = s ; } else { filename = s . substring ( lastSeparatorIndex + 1 ) ; } return filename ; }
removes the file extension .
