Exact file name extraction is required many times, when dealing with files
public static String extractFileName(String absoluteFileName) { if (!isNullOrEmpty(absoluteFileName)) { //File with the absolute path absoluteFileName = absoluteFileName.substring(absoluteFileName .lastIndexOf(File.separatorChar) + 1, absoluteFileName.lastIndexOf(".")); //File name extracted the absolute path } return absoluteFileName; }