Here you can find the source of getExtension(File file)
public static String getExtension(File file)
//package com.java2s; import java.io.File; public class Main { public static String getExtension(File file) { int startIndex = file.getName().lastIndexOf(46) + 1; int endIndex = file.getName().length(); return file.getName().substring(startIndex, endIndex); }//ww w. java 2 s . c o m }