You are on page 1of 1

public int[] buscarPares(){

int numeros[];
Nodo x=cab;
int cantidad=0;
Nodo ultimo=null;
while(x!=null){
if(x.getDato()%2==0)
cantidad++;
if(x.sig==null){ultimo=x;}
x=x.sig;
}
numeros=new int[cantidad];
x=ultimo;
int c=0;
while(x!=null){
if(x.getDato()%2==0)
numeros[c++]=x.getDato();
x=x.ant;
}
return numeros;
}

You might also like