Here you can find the source of getFileExtension(File file)
public static final String getFileExtension(File file)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { public static final String getFileExtension(File file) { String fileName = file.getAbsolutePath(); String ext = (fileName.lastIndexOf(".") == -1) ? "" : fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); return ext; }/*from w w w . j a va 2s . c o m*/ }