import java.util.ArrayList; import javax.swing.JOptionPane; /** * This program demonstrates the permutation generator. */ public class PermutationGeneratorDemo { public static void main(String[] args) { String string = JOptionPane.showInputDialog("Enter a String..."); PermutationGenerator generator = new PermutationGenerator(string); ArrayList permutations = generator.getPermutations(); String results = ""; for (String s : permutations) { results += s + '\n'; } JOptionPane.showMessageDialog(null, "The " + permutations.size() + " permutations of '" + string + "' are...\n" + results, "Permutation Generator", JOptionPane.INFORMATION_MESSAGE); } }