Here you can find the source of getFileExtension(String filename)
static public String getFileExtension(String filename)
//package com.java2s; //License from project: Apache License public class Main { static public String getFileExtension(String filename) { return getFileExtension(filename, ""); }/*from ww w. j a v a 2 s . c o m*/ static public String getFileExtension(String filename, String defExt) { if (filename == null || filename.length() == 0) return defExt; int pos = filename.lastIndexOf('.'); if (pos >= 0) { return filename.substring(pos + 1); } return defExt; } }