Here you can find the source of isImage(String fileName)
public static boolean isImage(String fileName)
//package com.java2s; public class Main { public static boolean isImage(String fileName) { String extension = getFileExtension(fileName.toLowerCase()); return "jpg".equals(extension) || "jpeg".equals(extension) || "gif".equals(extension) || "png".equals(extension) || "bmp".equals(extension) || "icon".equals(extension); }/* www. ja va2 s.c om*/ public static String getFileExtension(String fileName) { int index = fileName.lastIndexOf("."); if (index == -1) return null; return fileName.substring(index + 1); } }