Here you can find the source of getFileName(String absolutePath)
public static String getFileName(String absolutePath)
//package com.java2s; import java.io.File; public class Main { public static String getFileName(String absolutePath) { if (!isExist(absolutePath)) { return null; }// w w w .ja va 2 s.c o m File file = new File(absolutePath); return file.getName(); } public static boolean isExist(String path) { return new File(path).exists(); } }