Java Collection Tutorial - Java Arrays.hashCode(byte[] a)








Syntax

Arrays.hashCode(byte[] a) has the following syntax.

public static int hashCode(byte[] a)

Example

In the following code shows how to use Arrays.hashCode(byte[] a) method.

// ww w. j  a v  a 2s  . c  om

import java.util.Arrays;

public class Main {

  public static void main(String[] args) {

    byte[] bval = new byte[] { 10, 45 };
    
    System.out.println(Arrays.hashCode(bval));
    System.out.println(bval.hashCode());

  }
}

The code above generates the following result.