int[] a={1,2,3,4};
int[] b = {0,0,0};
Set<Integer> c= new HashSet<>();
for (int i = 0; i < a.length; i++) {
b[0]=a[i];
for (int j = 0; j < a.length; j++) {
if (a[j]!=a[i]) {
b[1]=a[j];
for (int j2 = 0; j2 < a.length; j2++) {
if(a[j2]!=a[j]&&a[j2]!=a[i]) {
b[2]=a[j2];
String d=b[0]+""+""+b[1]+""+b[2]+"";
System.out.println(d);
c.add(Integer.valueOf(d.trim()));
}
}
}
}
}
System.out.println(c); |