public boolean accept(File file)
    {
        String s = file.getName();
        int i = s.lastIndexOf('.');

        if(file.isDirectory())  //allow directories
            return true;

        if (i > 0 && i < s.length() - 1)
        {
            String extension = s.substring(i + 1).toLowerCase();
            int extValDec = -1, extValHex = -1;
            try
            {
                extValDec = Integer.parseInt(extension);    //check if extension is an integer (for split files)
            }
            catch(NumberFormatException nfe)
            {}          

            //          try
            //          {
            //              extValHex = Integer.parseInt(extension, 16);    //check if extension is a hex value
            //          }
            //          catch(NumberFormatException nfe)
            //          {}

            //allow: .img, .dd, .raw, .{integer}, .{2 chars}
            if (extension.equals("img") || extension.equals("dd") || extension.equals("raw") || extValDec != -1 || extension.length() == 2)
                return true;
            else
                return false;
        }
        return false;
    }