Java tutorial
//package com.java2s; import java.io.File; public class Main { public static String getFileSubFix(String fileName) { int index1 = fileName.lastIndexOf(File.separatorChar); int index2 = fileName.lastIndexOf("."); if (index2 <= index1) return ""; return fileName.substring(index2 + 1); } }