check if two subsets of integers are equal using equals method
- by MAS
I have this java method in class called IntArray. The class has  methods to add  integers to a set or remove  integers from a set,check size of a set, and check if 2 sets are equal. the 2 sets are created using 2 different objects of type IntArray in main, lets say object A and B.  equals method supposed to check if two sets of integers are equal. for example set A = {1,2,3} and B = {1,2,3,4}. The method still return true even though one set is a subset of the other set. What exactly I am doing wrong? Thanks.
//part of the code in main
IntArray A = new IntArray();
IntArray B = new IntArray();
if(A.equals(B))
System.out.println("A and B are equal");
 //equals method in IntArray class
 public boolean equals(Object b)
 {
  if (b instanceof IntArray)
    {
      IntArray A = (IntArray) b;
      for (int i = 0; i < data.length; i++)
      if (countOccurrences(data[i]) != A.countOccurrences(data[i]))
      return false;
      return true;
    }
 else return false;  
}