IntUtils class

IntUtils is a utility class in Dart that provides static methods for performing operations on integers. This class cannot be instantiated.

The methods in this class include, but are not limited to, methods for finding the greatest common denominator (GCD) of two integers using the Euclidean algorithm.

Example usage:

int gcd = IntUtils.findGCD(48, 18);  // returns 6

Note: All methods in this class are null-safe, meaning they will not throw an exception if the input integers are not within the expected range. Instead, they will return a reasonable default value (usually null).

Constructors

IntUtils.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

findGreatestCommonDenominator(int a, int b, {int depth = 0, int maxDepth = 500}) int?
This method finds the greatest common denominator of two integers. It uses the Euclidean algorithm, which is based on the principle that the greatest common denominator of two numbers does not change if the larger number is replaced by its difference with the smaller number.