Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static boolean isImageWithSuffixName(String suffixName) { if (isEmpty(suffixName)) { return false; } suffixName = suffixName.toLowerCase(); if ("jpg".equals(suffixName) || "jpeg".equals(suffixName) || "png".equals(suffixName) || "bmp".equals(suffixName) || "gif".equals(suffixName) || "tif".equals(suffixName)) { return true; } return false; } public static boolean isEmpty(String input) { if (input == null || "".equals(input) || "null".equals(input.toLowerCase())) return true; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { return false; } } return true; } }