Here you can find the source of fileExt(String url)
public static String fileExt(String url)
//package com.java2s; //License from project: Apache License public class Main { public static String fileExt(String url) { String ext = url.substring(url.lastIndexOf(".")); if (ext.contains("?")) { ext = ext.substring(0, ext.indexOf("?")); }/* w w w.j a va2 s .co m*/ if (ext.contains("%")) { ext = ext.substring(0, ext.indexOf("%")); } return ext; } }