Here you can find the source of getFilename (final String filepath)
public static String getFilename (final String filepath)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; public class Main { /**/*from w w w . j ava 2s .c o m*/ * @return name of file *or* directory. */ public static String getFilename(final String filepath) { final Path p = Paths.get(filepath); final Path filename = p.getFileName(); return filename == null ? null : filename.toString(); } /** Varargs wrapper */ public static String toString(final Object... objects) { return Arrays.toString(objects); } }