Here you can find the source of getFilename(String path)
public static String getFilename(String path)
//package com.java2s; public class Main { private static final String FOLDER_SEPARATOR = "/"; public static String getFilename(String path) { if (path == null) { return null; }// w w w . java 2 s . c om int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path); } }