multiplyHigh() in Java

multiplyHigh(): This method is available in the Math class of Java.

Syntax:

long java.lang.Math.multiplyHigh(long x, long y)

This method takes two arguments of type long as its parameters. This method returns as a long the most significant 64 bits of the 128-bit product of two 64-bit factors.

Parameters: Two parameters are required for this method.

x: the first value.

y: the second value.

Returns: the result.

For Example:

Math.multiplyHigh(83569,83561) = > It returns 0.

Approach

Java

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

        long x = 83569, y = 83561;
        System.out.println(Math.multiplyHigh(x, y));

    }
}

Output:

0

No comments:

Post a Comment