Java UUID.hashCode() method example

In this tutorial, You will learn how to get the hash code value of this UUID.

Returns a hash code for this UUID.


public int hashCode()


A hash code value for this UUID.

Java UUID hashCode() example

  • Initialize the String String name = "6224c18d-d004-11bd-984e-b8d80b2bdff8";
  • UUID.fromString(name); It creates a UUID from the string standard representation.
  • uuid.hashCode(); It returns the hashCode value associated with this UUID.
package com.technicalkeeda;

import java.util.UUID;

public class App {

    public static void main(String[] args) {

        String name = "6224c18d-d004-11bd-984e-b8d80b2bdff8";
        UUID uuid = UUID.fromString(name);

        System.out.println("The Hash Code value :-  " + uuid.hashCode());


The Hash Code value :-  558216976