Here you can find the source of getFileExtenSion(File file)
public static String getFileExtenSion(File file)
//package com.java2s; import java.io.File; import java.util.Locale; public class Main { public static String getFileExtenSion(File file) { String ex;/* w w w . j a v a 2 s.c o m*/ String filename; try { filename = file.getName(); ex = filename.substring(filename.lastIndexOf(".") + 1); } catch (Exception e) { return ""; } return ex.toLowerCase(Locale.getDefault()); } }