/ Java program to demonstrate how // to use gcd method of BigInteger class    import java.math.BigInteger;    class Test {     public static int gcd(int a, int b)     {         BigInteger b1 = BigInteger.valueOf(a);         BigInteger b2 = BigInteger.valueOf(b);         BigInteger gcd = b1.gcd(b2);         return gcd.intValue();     }        public static long gcd(long a, long b)     {         BigInteger b1 = BigInteger.valueOf(a);         BigInteger b2 = BigInteger.valueOf(b);         BigInteger gcd = b1.gcd(b2);         return gcd.longValue();     }        // Driver method     public static void main(String[] args)     {.

icon
Related questions
Question
/ Java program to demonstrate how
// to use gcd method of BigInteger class
  
import java.math.BigInteger;
  
class Test {
    public static int gcd(int a, int b)
    {
        BigInteger b1 = BigInteger.valueOf(a);
        BigInteger b2 = BigInteger.valueOf(b);
        BigInteger gcd = b1.gcd(b2);
        return gcd.intValue();
    }
  
    public static long gcd(long a, long b)
    {
        BigInteger b1 = BigInteger.valueOf(a);
        BigInteger b2 = BigInteger.valueOf(b);
        BigInteger gcd = b1.gcd(b2);
        return gcd.longValue();
    }
  
    // Driver method
    public static void main(String[] args)
    {.
 
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, data-structures-and-algorithms and related others by exploring similar questions and additional content below.
Similar questions