Here you can find the source of extractFileExtension(String filename)
public static String extractFileExtension(String filename)
//package com.java2s; public class Main { public static String extractFileExtension(String filename) { int lastslash = filename.lastIndexOf("/"); if (lastslash != -1) filename = filename.substring(lastslash + 1); lastslash = filename.lastIndexOf("\\"); if (lastslash != -1) filename = filename.substring(lastslash + 1); int lastdot = filename.lastIndexOf("."); if (lastdot != -1) return filename.substring(lastdot + 1); else/*from ww w . j a va 2 s . c o m*/ return ""; } }