Java tutorial
//package com.java2s; //License from project: LGPL import java.util.Arrays; import java.util.List; public class Main { private static final List<String> IMAGE_EXTENSIONS = Arrays .asList(("bmp,dds,gif,jpg,png,psd,pspimage,tga,thm,tif,tiff," + "yuv,abm,afx,cpg,cpt,dcm,dib,dpx,dt2,hdp,ipx,itc2,jp2,jpeg,jps,jpx,max,mng,mpo,mxi," + "pictclipping,ppm,psp,pspbrush,pvr,pxm,sdr,sid,skm,thm,tif,wb1,wbc,wbd,wbz,xcf,2bp," + "360,accountpicture-ms,acorn,agif,agp,apd,apng,apx,art,asw,avatar,avb,awd,blkrt,bm2," + "bmc,bss,can,cd5,cdg,cin,cit,colz,cpc,cps,csf,djvu,dm3,dmi,dtw,dvl,ecw,epp,exr,fits," + "fpos,fpx,gbr,gcdp,gih,gim,hdr,hdrp,hpi,i3d,info,ithmb,iwi,j2c,jb2,jbig2,jbr,jia,jng," + "jpc,jxr,kdi,lb,lif,lzp,mat,mbm,mix,mnr,mpf,mrxs,msp,myl,ncd,oc3,oc4,oc5,oci,omf,oplc" + ",ora,ota,ozb,pano,pat,pbm,pcd,pcx,pdd,pdn,pe4,pe4,pgf,pgm,pi2,pic,pic,picnc,pict," + "pixadex,pmg,pnm,pns,pov,ppf,prw,psb,psdx,pse,psf,ptg,px,pxd,pxr,pza,pzp,pzs,qmg,qti," + "qtif,ras,rif,rle,rli,rpf,rvg,s2mv,sai,sct,sig,skitch,spa,spe,sph,spj,spp,spr,sup,tbn," + "tex,tg4,thumb,tjp,tn,tpf,tps,vpe,vrphoto,vss,wbmp,webp,xpm,zif,73i,8xi,9,png,aic,ais," + "apm,aps,awd,bmf,bmx,bmz,brn,brt,bti,c4,cal,cals,cdc,cimg,cpbitmap,cpd,cpx,ct,dc2,dcx," + "ddt,dgt,dicom,djv,fax,fil,frm,gfie,ggr,gmbck,gmspr,gp4,gpd,gro,ica,icn,icon,icpr,ilbm," + "ink,int,ipick,ivr,j2k,jas,jbf,jfi,jfif,jif,jpd,jpe,jpf,jpg2,jtf,jwl,kic,kpg,lbm,ljp,mac," + "mic,msk,ncr,nct,odi,otb,oti,ozj,ozt,pap,pc3,pfi,pfr,pix,pjpg,pm,pni,pnt,pp4,pp5,pts,ptx," + "ptx,pwp,pxicon,rcu,rgb,rgf,ric,riff,rri,rsb,rsr,sbp,scn,sfc,sfw,sgi,shg,skypeemoticonset," + "sld,sprite,sumo,sun,sva,svm,t2b,tfc,tm2,tub,ufo,uga,vda,vic,viff,vst,wbm,wdp,wi,wpb," + "wpe,wvl,xbm,xwd,y,ysp,001,411,8pbs,acr,adc,albm,arr,artwork,arw,blz,brk,cam,ce,cut,ddb," + "drz,fac,face,fal,fbm,fpg,g3,gfb,grob,gry,hf,hr,hrf,ic1,ic2,ic3,icb,img,imj,iphotoproject," + "ivue,j,jbig,jbmp,jiff,kdk,kfx,kodak,mbm,mcs,met,mip,mrb,neo,nlm,pac,pal,pc1,pc2,pi1," + "pi2,pi3,pi4,pi5,pi6,pic,pix,pjpeg,pm3,pntg,pop,pov,ptk,qif,rcl,rgb,rix,rs,sar,scg,sci," + "scp,scu,sep,sff,sim,smp,sob,spc,spiff,spu,sr,ste,suniff,taac,tb0,tn1,tn2,tn3,tny,tpi," + "trif,u,urt,usertile-ms,v,vff,vna,wic,wmp,ai,eps,ps,svg,asy,cdd,cdmm,cdr,cgm,cvx,drw," + "emf,emz,fxg,graffle,hpl,plt,svgz,vsd,vsdx,xar,artb,cdmt,cdmtz,cdmz,cil,clarify,cmx," + "csy,cv5,cvg,cvi,dcs,design,dhs,dia,dpp,dpr,drawing,drw,dxb,egc,ep,epsf,ezdraw,fh10," + "fh11,fh9,fig,fs,gdraw,gstencil,hgl,hpg,hpgl,idea,igx,lmk,mgcb,mgmf,mgmx,mp,odg,pat,pen," + "pl,plt,rdl,scv,sk2,sketch,slddrt,snagitstamps,snagstyles,sxd,tlc,tne,ufr,vbr,vml,vsdm," + "vst,vstm,vstx,wmf,wmz,wpg,xmind,xmmap,abc,ac5,ac6,af3,art,awg,cag,ccx,cdt,cdx,cdx,cnv," + "cor,cvs,cwt,ddrw,ded,dpx,drawit,dsf,fh6,fh7,fh8,fhd,fif,fmv,ft11,ftn,gem,glox,gls,gsd," + "gtemplate,igt,ink,mgc,mgmt,mgs,mgtx,mmat,otg,ovp,ovr,psid,sda,sk1,smf,ssk,std,stn,svf," + "tpl,vec,xpr,yal,af2,cxf,fh3,fh4,fh5,ft10,ft7,ft8,ft9,gks,imd,ink,nap,pcs,pd,pfd,pfv," + "pmg,pobj,pws,zgm").split(",")); private static boolean isImage(String ext) { for (String s : IMAGE_EXTENSIONS) { if (s.equalsIgnoreCase(ext)) return true; } return false; } }