I did this using two for loops, but the teacher did not accept it.
I need to make the comparison using only a while loop.
EX. vetorA = {1,2,3,4,5,6,7,8}
, vetorB = {3,4,7,8,9,10}
This works, but it only needs to be a loop.
public void interseccao(int[] vetorA, int[] vetorB) {
for(int i=0; i < vetorA.length; i++){
for(int j=0; j < vetorB.length; j++){
if(vetorA[i] == vetorB[j]){
int temp = vetorA[i];
System.out.print(temp + " ");
}