Here you can find the source of getFileName(String filePath)
public static String getFileName(String filePath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileName(String filePath) { File f = new File(filePath); if (f.exists()) { return f.getName(); } else {// w w w. j a v a 2s .c o m return null; } } }