Java tutorial
//package com.java2s; public class Main { public static boolean rightType(String fileType, String ftype) { if (fileType == null || fileType.length() == 0) { return true; } if (fileType.equalsIgnoreCase("*")) return true; String[] fileTypes = fileType.split(","); for (int i = 0; i < fileTypes.length; i++) { if (fileTypes[i].equalsIgnoreCase(ftype)) { return true; } } return false; } }