Module hash4j

Class HashValue128

java.lang.Object
com.dynatrace.hash4j.hashing.HashValue128

public final class HashValue128 extends Object
Represents a 128-bit hash value. This class is immutable.
  • Constructor Details

    • HashValue128

      public HashValue128(long mostSignificantBits, long leastSignificantBits)
      Constructor.
      Parameters:
      mostSignificantBits - the 64 most significant bits of the hash value
      leastSignificantBits - the 64 least significant bits of the hash value
  • Method Details

    • getAsInt

      public int getAsInt()
      Returns the 32 least significant bits of the hash value.
      Returns:
      a 32-bit hash value
    • getMostSignificantBits

      public long getMostSignificantBits()
      Returns the 64 most significant bits of the hash value.
      Returns:
      a 64-bit hash value
    • getLeastSignificantBits

      public long getLeastSignificantBits()
      Returns the 64 least significant bits of the hash value.

      Equivalent to getAsLong().

      Returns:
      a 64-bit hash value
    • getAsLong

      public long getAsLong()
      Returns the 64 least significant bits of the hash value.
      Returns:
      a 64-bit hash value
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toByteArray

      public byte[] toByteArray()
      Returns this hash value as byte array.
      Returns:
      a byte array of length 16