Here you can find the source of getFileName(String path)
public static String getFileName(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileName(String path) { String filename = path;/*from www. j a v a 2s. c o m*/ if (filename.contains(File.separator)) { filename = filename.substring(filename.lastIndexOf(File.separatorChar) + 1); } return filename; } }