Here you can find the source of isFileImage(String fileName)
public static boolean isFileImage(String fileName)
//package com.java2s; //License from project: Open Source License import javax.activation.MimetypesFileTypeMap; public class Main { private static MimetypesFileTypeMap mtftp = new MimetypesFileTypeMap(); public static boolean isFileImage(String fileName) { String mimetype = mtftp.getContentType(fileName); String type = mimetype.split("/")[0]; return type.equals("image"); }/*from w w w. j a v a 2s. c o m*/ }