Here you can find the source of getFileName(File file)
public static String getFileName(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileName(File file) { if (file.isDirectory()) { return file.getName(); }/*from w w w . ja va 2 s . c om*/ String name = file.getName(); return name.substring(0, name.indexOf(".")); } }