Here you can find the source of basename(String path)
public static String basename(String path)
//package com.java2s; //License from project: Open Source License public class Main { public static String basename(String path) { int index = path.lastIndexOf('/'); if (index == -1) { throw new IllegalArgumentException("path does not contain '/'"); }// w ww . j a v a 2s . co m return path.substring(index + 1); } }