Great Common Divisor


Download jar file or use maven. psjava requires Java 1.6 (or above)


Example Code

// Usage is very simple. Remember that you can use various number systems.

int gcd1 = GCD.gcd(IntegerNumberSystem.getInstance(), 25, 10); // must be 5
long gcd2 = GCD.gcd(LongNumberSystem.getInstance(), 25L, 10L); // must be 5
BigInteger gcd3 = GCD.gcd(BigIntegerNumberSystem.getInstance(), BigInteger.valueOf(25), BigInteger.valueOf(10)); // must be, 5!


Copyright 2014 psjava team. View on GitHub