import java.util.Arrays; public class Main { public static void main(String[] args) { char [] data = {'A','B','C'}; f(data,0); } private static void f(char [] data,int k){ if(k == data.length){ System.out.println(Arrays.toString(data)); } for (int i = k; i < data.length; i++) { char temp = data[k]; data[k]=data[i]; data[i]=temp; f(data,k+1); temp=data[k]; data[k]=data[i]; data[i]=temp; } } }