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








Syntax

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

public static int hashCode(short[] a)

Example

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

/*from   w  ww. j av  a  2 s  .co m*/
import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
    
    // initializing short array
    short[] sval = new short[] { 2 };

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

The code above generates the following result.