Here you can find the source of fileName(String contentFile)
static String fileName(String contentFile)
//package com.java2s; //License from project: Open Source License public class Main { static String fileName(String contentFile) { if (contentFile == null || contentFile.isEmpty()) { return ""; }/*from ww w .j a v a 2s. co m*/ int i1 = contentFile.lastIndexOf("/"); int i2 = contentFile.lastIndexOf("\\"); if (i1 > 0 || i2 > 0) { return contentFile.substring(Math.max(i1, i2) + 1); } return contentFile; } }