List A={2,3,3} List B={2,3,5}
I want to get only {2,3} to do the gcd
I tried to use retainall() but result is {2,3,3}
public static int gcd(ArrayList<Integer> A,ArrayList<Integer> B)
{ //A={2,3,3},B={2,3,5}
A.retainAll(B);
System.out.println(A);
}