Java Data Type Tutorial - Byte hashCode(byte value) example








Byte hashCode(byte value) returns a hash code for a byte value.

Syntax

hashCode has the following syntax.

public static int hashCode(byte value)

Parameters

hashCode has the following parameters.

value
the value to hash

Return

hashCode returns a hash code value for a byte value.

Example

The following example shows how to use hashCode.


public class Main {
  public static void main(String...args){
    byte b = 2;
    System.out.println(Byte.hashCode(b));
  }
}

The code above generates the following result.