public class Test {
private static String[] array = {"a","b","c"};
private static void display(String index,String position)
{
if(index.length() == array.length)
{
System.out.println(index);
return;
}
for(int i = 0; i < position.length(); i++)
{
String newIndex = index + position.charAt(i);
String newposition = position.replace(String.valueOf(position.charAt(i)), "");
display(newIndex,newposition);
}
}
public static void main(String[] args) {
display("","abc");
}
}