Arrays.hashCode(double[]) in Java

Arrays.hashCode(double[]): This method is available in java.util.Arrays class of Java.

Syntax:

int java.util.Arrays.hashCode(double[] a)

This method takes one argument of type double array as its parameter. This method returns a hash code based on the contents of the specified array.

Note: If a is null, this method returns 0.

Parameters: One parameter is required for this method.

a: the array whose hash value to compute.

Returns: a content-based hash code for a.

Exceptions: NA

Approach

Java

import java.util.Arrays;

public class ArrayshashCodedouble {
    public static void main(String[] args) {

        double a[] = { 4, 5, 10 };

        System.out.println(Arrays.hashCode(a));
    }
}

Output:

2124444767


No comments:

Post a Comment