Here you can find the source of GetFileExtension(String path)
public static String GetFileExtension(String path)
//package com.java2s; /*//from ww w . j a v a2s .c o m * This is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute * it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by * Sam Hocevar. See http://www.wtfpl.net/ for more details. */ public class Main { public static String GetFileExtension(String path) { String extension = ""; if (path != null && path.length() > 0) { int idx = path.lastIndexOf('.'); if (idx >= 0) { int lastSlashIdx = path.lastIndexOf(java.io.File.separatorChar); if (idx > lastSlashIdx) { extension = path.substring(idx + 1); } } } return extension; } }