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) { return getFileExtension(f.getAbsolutePath()); }//from w w w . j a va2 s.c om public static String getFileExtension(String path) { try { return path.substring(path.lastIndexOf('.') + 1).toLowerCase(); } catch (Exception e) { return null; } } }