Here you can find the source of getFileExtension(File file)
private static String getFileExtension(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { private static String getFileExtension(File file) { String fileName = file.getName(); if (fileName.lastIndexOf(".") != -1 && fileName.lastIndexOf(".") != 0) return fileName.substring(fileName.lastIndexOf(".") + 1); else/* w ww. jav a 2 s. co m*/ return ""; } }