I need to a file’s suffix with an array list like
String[] FileType = {"pdf","mp3","jpg"}
File SourceFileToCheckType = new File("C:\\Users\\RS\\Desktop\\test.pdf");
using method below…. this method is full off errors how to deal with such situation
public static boolean FileTypeAccept(File SourceFileToCheckType, String[] fileType)
{
for (String filetypeS : fileType)
return SourceFileToCheckType.getName().endsWith("." + filetypeS);
}
You are almost done. Try this code: