日期:2014-05-20 浏览次数:20662 次
int[] a = {-1,4,5};
int[] b = {-15,1,3,4,5,7,8,9,10,15};
int init = 0;
List<Integer> rtnList = new ArrayList<Integer>();
for(int i = 0;i<a.length;i++) {
for(int j = init;j<b.length;j++){
if (a[i] == b[j]) {
init=j+1;
rtnList.add(a[i]);
break;
}
}
}
int[] a = {-1,4,5};
int[] b = {-15,1,3,4,5,7,8,9,10,15};
int init = 0;
List<Integer> rtnList = new ArrayList<Integer>();
for(int i = 0;i<a.length;i++) {
for(int j = init;j<b.length;j++){
System.out.println("[i:"+i+"][a[i]:"+a[i]+"][j:"+j+"][b[j]:"+b[j]+"]");
if (a[i] == b[j]) {
init=j+1;
rtnList.add(a[i]);