Here you can find the source of getFileExtension(String file)
public static String getFileExtension(String file)
//package com.java2s; import java.io.File; public class Main { public static String getFileExtension(String file) { return getFileExtension(new File(file)); }//from w w w .j av a 2 s . c o m public static String getFileExtension(File file) { String s = file.toString(); return s.substring(s.lastIndexOf(".") + 1, s.length()); } }