标签:i++ tin src [] bool else array java highlight
public static int[] getNewArray(int[] array) { int[] temp = new int[array.length]; int t = 0; for(int i=0;i<array.length;i++) { boolean flag = true; for(int j=0;j<i;j++) { if(i==0) { continue; }else if(array[i]==temp[j]) { flag = false; break; } } if(flag) { temp[t++] = array[i]; } } int[] newArray = new int[t]; System.arraycopy(temp, 0, newArray, 0, t); return newArray; }
运行结果:
标签:i++ tin src [] bool else array java highlight
原文地址:http://www.cnblogs.com/houxudong/p/7399067.html