Java tutorial
//package com.java2s; import java.io.File; import java.util.Locale; public class Main { public static String getFileExtenSion(File file) { String ex; String filename; try { filename = file.getName(); ex = filename.substring(filename.lastIndexOf(".") + 1); } catch (Exception e) { return ""; } return ex.toLowerCase(Locale.getDefault()); } }