import java.util.LinkedList;
public class MainC {
public static void main(String[] args) {
// int[] a = { 1, 2, 3, 4 };
// int[] b = { 0, 1, 5, 3 };
// int[] c = new int[a.length+b.length];
// int[] d= new int[a.length+b.length];
// for(int n=0;n<a.length;n++)
// {
// c[n]=a[n];
// }
// for(int k=a.length;k<c.length;k++)
// {
// c[k]=b[k-a.length];
// }
// int z = 0;
// for (int x = 0; x < a.length; x++)
// {
// for (int y = 0; y < b.length; y++)
// {
// if (a[x] == b[y])
// {
// d[z]=a[x];
// z++;
// }
// }
// }
// for (int m = 0; m < c.length; m++)
// {
// for(int h=0;h<d.length;h++)
// {
// if(d[h]!=0)
// {
// if (c[m]== d[h])
// {
// c[m]=-1;
// }
// }
// }
// }
// for(int j=0;j<c.length;j++)
// {
// if(c[j]!=-1)
// {
// System.out.println(c[j]);
// }
// }
String[] arr1 = new String[]{"1","2","3","7","9"};
String[] arr2 = new String[]{"1","2","3","7"};
String[] arro = arrContrast(arr1, arr2);//“arro”就是您想得到的数组
System.out.println("您想要的结果为:");
for (String str : arro) {
System.out.println(str);
}
}
private static String[] arrContrast(String[] arr1, String[] arr2) {
LinkedList<String> list = new LinkedList<String>();
for (String str : arr1) {
if (!list.contains(str)) {
list.add(str);
}
}
for (String str : arr2) {
if (list.contains(str)) {
list.remove(str);
}
}
String[] result = {};
return list.toArray(result);
}
}