For primitive type: Arrays.equals(a1,a2)
For reference type: Arrays.deepEquals(a1,a2)
A simple way is to run a loop and compare elements one by one.
Java provides a direct method to compare two arrays.
Actually, there is a list of equals() methods in Arrays class for different primitive types (int, char, ..etc) and one for Object type (which is base of all classes in Java).
Issue with the equals() method:
If the arrays contain arrays inside them or some other references which refer to different object but have same values.