Here you can find the source of getFileExtension(File file)
public static String getFileExtension(File file)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static String getFileExtension(File file) { String extension = file.getAbsolutePath().substring( file.getAbsolutePath().lastIndexOf('.') + 1); return extension; }/*w ww . j a v a2s. c o m*/ public static String getFileExtension(String str) { String extension = str.substring(str.lastIndexOf('.') + 1); return extension; } }