Let\'s say I have the following two arrays:
int[] a = [1,2,3,4,5]; int[] b = [8,1,3,9,4];
I would like to take the first value of array
You just need two nested for loops
for(int i = 0; i < a.length; i++) { for(int j = 0; j < b.length; j++) { if(a[i] == b[j]) { //value is in both arrays } } }
What this does is go to the first value of a and compare to each value in b, then go to the next value of a and repeat.