Here you can find the source of getFileExtension(File f)
public static String getFileExtension(File f)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileExtension(File f) { String ext = null;//from ww w . j a v a 2 s . com String str = f.getName(); int ind = str.lastIndexOf('.'); if (ind > 0 && ind < str.length() - 1) { ext = str.substring(ind + 1).toLowerCase(); } return ext; } }