Java tutorial
//package com.java2s; import java.io.File; public class Main { public static String getFileType(File file) { String fileName = file.getName(); int typeIndex = fileName.lastIndexOf("."); if (typeIndex != -1) { return fileName.substring(typeIndex + 1).toLowerCase(); } else { return ""; } } }