BigInteger hashCode() in Java

hashCode(): This method is available in java.math.BigInteger class of Java.

Syntax:

int java.math.BigInteger.hashCode()

This method returns the hash code for this BigInteger.

Returns: hash code for this  BigInteger.

For Example:

BigInteger bigInteger = new BigInteger("1234")

bigInteger.hashCode() = > It returns 1234.

Approach

Java

import java.math.BigInteger;

public class BigIntegerhashCode {
    public static void main(String[] args) {

        BigInteger bigInteger = new BigInteger("1234");
        System.out.println(bigInteger.hashCode());

    }
}

Output:

1234

No comments:

Post a Comment