Arrays.hashCode() – hash code of an array

Returns a hash code based on the contents of the specified array.The value returned by this method is the same value that would be obtained by invoking the hashCode() method on a List containing a sequence of Integer instances representing the elements of a in the same order. If a is null, this method returns 0.

Code Explanation
LineDescription
5Declaration and initialization of the array myArray with the values 1, 2, 3, 4 and 5.
7The hashCode() Method returns a hash code based on the contents of myArray
import java.util.Arrays;

public class ArraysMethods {
    public static void main(String[] args) {
        int[] myArray = { 1, 2, 3, 4, 5 };

        System.out.println(Arrays.hashCode(myArray));        
    }
}
Output
29615266