Here you can find the source of createFileFilter(String text, String[]... suffixes)
public static FileNameExtensionFilter createFileFilter(String text, String[]... suffixes)
//package com.java2s; //License from project: Open Source License import java.util.SortedSet; import java.util.TreeSet; import javax.swing.filechooser.FileNameExtensionFilter; public class Main { public static FileNameExtensionFilter createFileFilter(String text, String[]... suffixes) { SortedSet<String> sortedSuffixes = new TreeSet<>(); if (suffixes != null) { for (String[] a : suffixes) { if (a != null) { for (String s : a) { if (s != null) { sortedSuffixes.add(s.toLowerCase()); }// w ww . j a v a2s. co m } } } } if (!sortedSuffixes.isEmpty()) { StringBuilder buf = new StringBuilder(256); buf.append(text); boolean isFirst = true; for (String s : sortedSuffixes) { if (isFirst) { buf.append(" ("); isFirst = false; } else { buf.append("; "); } buf.append("*."); buf.append(s); } if (!isFirst) { buf.append((char) ')'); } text = buf.toString(); } return new FileNameExtensionFilter(text, sortedSuffixes.toArray(new String[sortedSuffixes.size()])); } }