1import java.util.LinkedList;
2import java.io.File;
3public class getFileExtention{
4 public static String[] getExt(File path, String extentionType) {
5 String [] g = path.list();
6 //We need to convert it into a linkedlist for
7 //adding whatever we want any size
8 //You could also do it with a number
9 //and iterate over it
10 LinkedList<String> h = new LinkedList<String>();
11 for(int c = 0;c < g.length;c++) {
12 if(g[c].endsWith(extentionType)) {
13 h.add(g[c]);
14 }
15 }
16 String[] j = new String[h.size()];
17 //Covert it into a array again
18 //but not if you made it into a linked list type method
19 for (int d = 0; d < h.size(); d++) {
20 j[d] = h.get(d);
21 }
22 return j;
23 }
24}