Here you can find the source of getFileNameFromPath(String filePath)
public static String getFileNameFromPath(String filePath)
//package com.java2s; /*/* w ww . j av a 2 s .c o m*/ * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the license found in the LICENSE file in * the root directory of this source tree. */ import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static String getFileNameFromPath(String filePath) { Path p = Paths.get(filePath); return p.getFileName().toString(); } }