Class MathPlume
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
bitwiseAnd
(int x, int y) Returns x & y, the bitwise and of its arguments.static long
bitwiseAnd
(long x, long y) Returns x & y, the bitwise and of its arguments.static int
bitwiseComplement
(int a) Returns ~a, the bitwise complement of its argument.static long
bitwiseComplement
(long a) Returns ~a, the bitwise complement of its argument.static int
bitwiseOr
(int x, int y) Returns x | y, the bitwise or of its arguments.static long
bitwiseOr
(long x, long y) Returns x | y, the bitwise or of its arguments.static int
bitwiseXor
(int x, int y) Returns x ^ y, the bitwise xor of its arguments.static long
bitwiseXor
(long x, long y) Returns x ^ y, the bitwise xor of its arguments.static double
div
(double x, double y) Divides its arguments.static int
div
(int x, int y) Divides its arguments.static long
div
(long x, long y) Divides its arguments.static double
gcd
(double[] a) Returns the greatest common divisor of the elements of double array a.static double
gcd
(double a, double b) Returns the greatest common divisor of the two arguments.static int
gcd
(int[] a) Returns the greatest common divisor of the elements of int array a.static int
gcd
(int a, int b) Returns the greatest common divisor of the two arguments.static long
gcd
(long[] a) Returns the greatest common divisor of the elements of long array a.static long
gcd
(long a, long b) Returns the greatest common divisor of the two arguments.static double
gcdDifferences
(double[] a) Returns the gcd (greatest common divisor) of the differences between the elements of double array a.static int
gcdDifferences
(int[] a) Returns the gcd (greatest common divisor) of the differences between the elements of int array a.static long
gcdDifferences
(long[] a) Returns the gcd (greatest common divisor) of the differences between the elements of long array a.static int
logicalAnd
(int x, int y) Returns the logical and of its arguments.static long
logicalAnd
(long x, long y) Returns the logical and of its arguments.static int
logicalOr
(int x, int y) Returns the logical or of its arguments.static long
logicalOr
(long x, long y) Returns the logical or of its arguments.static int
logicalXor
(int x, int y) Returns the logical xor of its arguments.static long
logicalXor
(long x, long y) Returns the logical xor of its arguments.static int
lshift
(int x, int y) Returns x << y, the left-shift operation applied to its arguments.static long
lshift
(long x, long y) Returns x << y, the left-shift operation applied to its arguments.static int[]
missingNumbers
(int @MinLen(1) [] nums) Returns an array containing all the numbers not in its argument array (which must be non-empty) but in the argument's range; that is, bigger than its argument's minimum value and smaller than its argument's maximum value.static long[]
missingNumbers
(long @MinLen(1) [] nums) Returns an array containing all the numbers not in its argument array (which must be non-empty) but in the argument's range; that is, bigger than its argument's minimum value and smaller than its argument's maximum value.static int
mod
(int x, int y) Returns x % y, the modulus operation applied to its arguments.static long
mod
(long x, long y) Returns x % y, the modulus operation applied to its arguments.static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound int
modNonnegative
(int x, @org.checkerframework.checker.index.qual.PolyUpperBound int y) Returns z such that(z == x mod y) && (0 <= z < abs(y))
.static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound long
modNonnegative
(long x, @org.checkerframework.checker.index.qual.PolyUpperBound long y) Returns z such that(z == x mod y) && (0 <= z < abs(y))
.static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound int
modPositive
(int x, @org.checkerframework.checker.index.qual.PolyUpperBound int y) Deprecated.static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound long
modPositive
(long x, @org.checkerframework.checker.index.qual.PolyUpperBound long y) Deprecated.static int @Nullable @ArrayLen(2) []
modulus
(int[] nums) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m).static long @Nullable @ArrayLen(2) []
modulus
(long[] nums) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m).static int @Nullable @ArrayLen(2) []
modulusInt
(Iterator<Integer> itor) The iterator produces Integer values.static long @Nullable @ArrayLen(2) []
modulusLong
(Iterator<Long> itor) The iterator produces Long values.static int @Nullable @ArrayLen(2) []
modulusStrict
(int[] nums, boolean nonstrictEnds) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m).static long @Nullable @ArrayLen(2) []
modulusStrict
(long[] nums, boolean nonstrictEnds) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m).static int @Nullable @ArrayLen(2) []
modulusStrictInt
(Iterator<Integer> itor, boolean nonstrictEnds) The iterator produces Integer values.static long @Nullable @ArrayLen(2) []
modulusStrictLong
(Iterator<Long> itor, boolean nonstrictEnds) The iterator produces Long values.static double
mul
(double x, double y) Multiplies its arguments.static int
mul
(int x, int y) Multiplies its arguments.static long
mul
(long x, long y) Multiplies its arguments.static double
negate
(double a) Negates its argument.static int
negate
(int a) Negates its argument.static long
negate
(long a) Negates its argument.static int @Nullable @ArrayLen(2) []
nonmodulusNonstrict
(int[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but for every number in NUMS, at least one is equal to every non-r remainder.static long @Nullable @ArrayLen(2) []
nonmodulusNonstrict
(long[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but for every number in NUMS, at least one is equal to every non-r remainder.static int @Nullable @ArrayLen(2) []
nonmodulusStrict
(int[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.static long @Nullable @ArrayLen(2) []
nonmodulusStrict
(long[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.static int @Nullable @ArrayLen(2) []
nonmodulusStrictInt
(Iterator<Integer> nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.static long @Nullable @ArrayLen(2) []
nonmodulusStrictLong
(Iterator<Long> nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.static int
pow
(int base, int expt) Returns of value of the first argument raised to the power of the second argument.static long
pow
(long base, long expt) Returns of value of the first argument raised to the power of the second argument.static int
rshiftSigned
(int x, int y) Returns x >> y, the signed right-shift operation applied to its arguments.static long
rshiftSigned
(long x, long y) Returns x >> y, the signed right-shift operation applied to its arguments.static @org.checkerframework.checker.signedness.qual.Unsigned int
rshiftUnsigned
(@org.checkerframework.checker.signedness.qual.Unsigned int x, int y) Returns x >>> y, the unsigned right-shift operation applied to its arguments.static @org.checkerframework.checker.signedness.qual.Unsigned long
rshiftUnsigned
(@org.checkerframework.checker.signedness.qual.Unsigned long x, long y) Returns x >>> y, the unsigned right-shift operation applied to its arguments.static int
sign
(int a) Returns the sign of its argument.
-
Method Details
-
negate
@Pure @StaticallyExecutable public static int negate(int a) Negates its argument.- Parameters:
a
- value to negate- Returns:
- negative of a
-
negate
@Pure @StaticallyExecutable public static long negate(long a) Negates its argument.- Parameters:
a
- value to negate- Returns:
- negative of a
-
negate
@Pure @StaticallyExecutable public static double negate(double a) Negates its argument.- Parameters:
a
- value to negate- Returns:
- negative of a
-
bitwiseComplement
@Pure @StaticallyExecutable public static int bitwiseComplement(int a) Returns ~a, the bitwise complement of its argument.- Parameters:
a
- value to bitwise-complement- Returns:
- ~a, the bitwise complement of a
-
bitwiseComplement
@Pure @StaticallyExecutable public static long bitwiseComplement(long a) Returns ~a, the bitwise complement of its argument.- Parameters:
a
- value to bitwise-complement- Returns:
- ~a, the bitwise complement of a
-
mul
@Pure @StaticallyExecutable public static int mul(int x, int y) Multiplies its arguments.- Parameters:
x
- first multiplicandy
- second multiplicand- Returns:
- x * y
-
mul
@Pure @StaticallyExecutable public static long mul(long x, long y) Multiplies its arguments.- Parameters:
x
- first multiplicandy
- second multiplicand- Returns:
- x * y
-
mul
@Pure @StaticallyExecutable public static double mul(double x, double y) Multiplies its arguments.- Parameters:
x
- first multiplicandy
- second multiplicand- Returns:
- x * y
-
div
@Pure @StaticallyExecutable public static int div(int x, int y) Divides its arguments.- Parameters:
x
- dividendy
- divisor- Returns:
- x / y
-
div
@Pure @StaticallyExecutable public static long div(long x, long y) Divides its arguments.- Parameters:
x
- dividendy
- divisor- Returns:
- x / y
-
div
@Pure @StaticallyExecutable public static double div(double x, double y) Divides its arguments.- Parameters:
x
- dividendy
- divisor- Returns:
- x / y
-
mod
@Pure @StaticallyExecutable public static int mod(int x, int y) Returns x % y, the modulus operation applied to its arguments.- Parameters:
x
- valued to be moddedy
- modulus- Returns:
- x % y
-
mod
@Pure @StaticallyExecutable public static long mod(long x, long y) Returns x % y, the modulus operation applied to its arguments.- Parameters:
x
- valued to be moddedy
- modulus- Returns:
- x % y
-
lshift
@Pure @StaticallyExecutable public static int lshift(int x, int y) Returns x << y, the left-shift operation applied to its arguments.- Parameters:
x
- valued to be left-shiftedy
- magnitude of the left-shift- Returns:
- x << y
-
lshift
@Pure @StaticallyExecutable public static long lshift(long x, long y) Returns x << y, the left-shift operation applied to its arguments.- Parameters:
x
- valued to be left-shiftedy
- magnitude of the left-shift- Returns:
- x << y
-
rshiftSigned
@Pure @StaticallyExecutable public static int rshiftSigned(int x, int y) Returns x >> y, the signed right-shift operation applied to its arguments.- Parameters:
x
- valued to be right-shiftedy
- magnitude of the right-shift- Returns:
- x >> y
-
rshiftSigned
@Pure @StaticallyExecutable public static long rshiftSigned(long x, long y) Returns x >> y, the signed right-shift operation applied to its arguments.- Parameters:
x
- valued to be right-shiftedy
- magnitude of the right-shift- Returns:
- x >> y
-
rshiftUnsigned
@Pure @StaticallyExecutable public static @org.checkerframework.checker.signedness.qual.Unsigned int rshiftUnsigned(@org.checkerframework.checker.signedness.qual.Unsigned int x, int y) Returns x >>> y, the unsigned right-shift operation applied to its arguments.- Parameters:
x
- valued to be right-shiftedy
- magnitude of the right-shift- Returns:
- x >>> y
-
rshiftUnsigned
@Pure @StaticallyExecutable public static @org.checkerframework.checker.signedness.qual.Unsigned long rshiftUnsigned(@org.checkerframework.checker.signedness.qual.Unsigned long x, long y) Returns x >>> y, the unsigned right-shift operation applied to its arguments.- Parameters:
x
- valued to be right-shiftedy
- magnitude of the right-shift- Returns:
- x >>> y
-
bitwiseAnd
@Pure @StaticallyExecutable public static int bitwiseAnd(int x, int y) Returns x & y, the bitwise and of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x & y
-
bitwiseAnd
@Pure @StaticallyExecutable public static long bitwiseAnd(long x, long y) Returns x & y, the bitwise and of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x & y
-
logicalAnd
@Pure @StaticallyExecutable public static int logicalAnd(int x, int y) Returns the logical and of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical and of x and y; the result is always 0 or 1
-
logicalAnd
@Pure @StaticallyExecutable public static long logicalAnd(long x, long y) Returns the logical and of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical and of x and y; the result is always 0 or 1
-
bitwiseXor
@Pure @StaticallyExecutable public static int bitwiseXor(int x, int y) Returns x ^ y, the bitwise xor of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x ^ y
-
bitwiseXor
@Pure @StaticallyExecutable public static long bitwiseXor(long x, long y) Returns x ^ y, the bitwise xor of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x ^ y
-
logicalXor
@Pure @StaticallyExecutable public static int logicalXor(int x, int y) Returns the logical xor of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical xor of x and y; the result is always 0 or 1
-
logicalXor
@Pure @StaticallyExecutable public static long logicalXor(long x, long y) Returns the logical xor of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical xor of x and y; the result is always 0 or 1
-
bitwiseOr
@Pure @StaticallyExecutable public static int bitwiseOr(int x, int y) Returns x | y, the bitwise or of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x | y
-
bitwiseOr
@Pure @StaticallyExecutable public static long bitwiseOr(long x, long y) Returns x | y, the bitwise or of its arguments.- Parameters:
x
- first operandy
- second operand- Returns:
- x | y
-
logicalOr
@Pure @StaticallyExecutable public static int logicalOr(int x, int y) Returns the logical or of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical or of x and y; the result is always 0 or 1
-
logicalOr
@Pure @StaticallyExecutable public static long logicalOr(long x, long y) Returns the logical or of its arguments. The result is always 0 or 1.- Parameters:
x
- first operandy
- second operand- Returns:
- the logical or of x and y; the result is always 0 or 1
-
sign
@Pure @StaticallyExecutable public static int sign(int a) Returns the sign of its argument. The result is always -1, 0, or 1.- Parameters:
a
- value to have its sign taken- Returns:
- the sign of a: -1, 0, or 1
-
pow
Returns of value of the first argument raised to the power of the second argument. The arguments are integers.- Parameters:
base
- the baseexpt
- the exponent- Returns:
- base to the expt power
- Throws:
ArithmeticException
- See Also:
-
pow
Returns of value of the first argument raised to the power of the second argument.- Parameters:
base
- the baseexpt
- the exponent- Returns:
- base to the expt power
- Throws:
ArithmeticException
- See Also:
-
gcd
@Pure @StaticallyExecutable public static int gcd(int a, int b) Returns the greatest common divisor of the two arguments.- Parameters:
a
- first operandb
- second operand- Returns:
- greatest common divisor of a and b
-
gcd
@Pure @StaticallyExecutable public static int gcd(int[] a) Returns the greatest common divisor of the elements of int array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the elements of a
-
gcdDifferences
@Pure @StaticallyExecutable public static int gcdDifferences(int[] a) Returns the gcd (greatest common divisor) of the differences between the elements of int array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the differences between the elements of a
-
gcd
@Pure @StaticallyExecutable public static long gcd(long a, long b) Returns the greatest common divisor of the two arguments.- Parameters:
a
- first operandb
- second operand- Returns:
- greatest common divisor of a and b
-
gcd
@Pure @StaticallyExecutable public static long gcd(long[] a) Returns the greatest common divisor of the elements of long array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the elements of a
-
gcdDifferences
@Pure @StaticallyExecutable public static long gcdDifferences(long[] a) Returns the gcd (greatest common divisor) of the differences between the elements of long array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the differences between the elements of a
-
gcd
@Pure @StaticallyExecutable public static double gcd(double a, double b) Returns the greatest common divisor of the two arguments.- Parameters:
a
- first operandb
- second operand- Returns:
- greatest common divisor of a and b
-
gcd
@Pure @StaticallyExecutable public static double gcd(double[] a) Returns the greatest common divisor of the elements of double array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the elements of a
-
gcdDifferences
@Pure @StaticallyExecutable public static double gcdDifferences(double[] a) Returns the gcd (greatest common divisor) of the differences between the elements of double array a.- Parameters:
a
- array of operands- Returns:
- greatest common divisor of the differences between the elements of a
-
modPositive
@Deprecated @Pure @StaticallyExecutable public static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound int modPositive(int x, @org.checkerframework.checker.index.qual.PolyUpperBound int y) Deprecated.Returns z such that(z == x mod y) && (0 <= z < abs(y))
. This should really be namedmodNonnegative
rather thanmodPositive
.- Parameters:
x
- value to be moddedy
- modulus- Returns:
- x % y, where the result is constrained to be non-negative
-
modNonnegative
@Pure @StaticallyExecutable public static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound int modNonnegative(int x, @org.checkerframework.checker.index.qual.PolyUpperBound int y) Returns z such that(z == x mod y) && (0 <= z < abs(y))
.- Parameters:
x
- value to be moddedy
- modulus- Returns:
- x % y, where the result is constrained to be non-negative
-
modulus
@SideEffectFree @StaticallyExecutable public static int @Nullable @ArrayLen(2) [] modulus(int[] nums) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m). The largest possible modulus is used, and the trivial constraint that all integers are equal to 0 mod 1 is not returned (null is returned instead). Also, return null if the array is less than 3 elements long.- Parameters:
nums
- array of operands- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
-
modulusInt
The iterator produces Integer values. This can be more efficient than modulus(int[]) if the int[] doesn't already exist, because this does not necessarily examine every value produced by its iterator.- Parameters:
itor
- iterator of operands; modified by this method- Returns:
- an array of two integers (r,m) such that each number in itor is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
- See Also:
-
modulusStrict
@SideEffectFree @StaticallyExecutable public static int @Nullable @ArrayLen(2) [] modulusStrict(int[] nums, boolean nonstrictEnds) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m). The largest possible modulus is used, and the trivial constraint that all integers are equal to 0 mod 1 is not returned (null is returned instead).This "Strict" version requires its input to be sorted, and no element may be missing.
This "Strict" version differs from the regular modulus by requiring that the argument be dense: that is, every pair of numbers in the argument array is separated by exactly the modulus.
The endpoints can be treated in two different ways: Either exactly like other numbers in the input, or they can merely be checked for the condition without the strict density requirement.
- Parameters:
nums
- array of operandsnonstrictEnds
- whether endpoints are NOT subject to the strict density requirement- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the array contains fewer than 3 elements
-
modulusStrictInt
public static int @Nullable @ArrayLen(2) [] modulusStrictInt(Iterator<Integer> itor, boolean nonstrictEnds) The iterator produces Integer values. This can be more efficient than modulus(int[]) if the int[] doesn't already exist, because this does not necessarily examine every value produced by its iterator.For documentation, see
modulusStrict(int[], boolean)
.- Parameters:
itor
- iterator of operands; modified by this methodnonstrictEnds
- whether endpoints are NOT subject to the strict density requirement- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
- See Also:
-
modPositive
@Deprecated @Pure @StaticallyExecutable public static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound long modPositive(long x, @org.checkerframework.checker.index.qual.PolyUpperBound long y) Deprecated.Returns z such that(z == x mod y) && (0 <= z < abs(y))
. This should really be namedmodNonnegative
rather thanmodPositive
.- Parameters:
x
- value to be moddedy
- modulus- Returns:
- x % y, where the result is constrained to be non-negative
-
modNonnegative
@Pure @StaticallyExecutable public static @org.checkerframework.checker.index.qual.NonNegative,@org.checkerframework.checker.index.qual.LessThan({"#2"}),@org.checkerframework.checker.index.qual.PolyUpperBound long modNonnegative(long x, @org.checkerframework.checker.index.qual.PolyUpperBound long y) Returns z such that(z == x mod y) && (0 <= z < abs(y))
.- Parameters:
x
- value to be moddedy
- modulus- Returns:
- x % y, where the result is constrained to be non-negative
-
modulus
@SideEffectFree @StaticallyExecutable public static long @Nullable @ArrayLen(2) [] modulus(long[] nums) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m). The largest possible modulus is used, and the trivial constraint that all integers are equal to 0 mod 1 is not returned (null is returned instead). Also, return null if the array is less than 3 elements long.- Parameters:
nums
- array of operands- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
-
modulusLong
The iterator produces Long values. This can be more efficient than modulus(long[]) if the long[] doesn't already exist, because this does not necessarily examine every value produced by its iterator.- Parameters:
itor
- iterator of operands; modified by this method- Returns:
- an array of two integers (r,m) such that each number in itor is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
- See Also:
-
modulusStrict
@SideEffectFree @StaticallyExecutable public static long @Nullable @ArrayLen(2) [] modulusStrict(long[] nums, boolean nonstrictEnds) Returns an array of two integers (r,m) such that each number in NUMS is equal to r (mod m). The largest possible modulus is used, and the trivial constraint that all integers are equal to 0 mod 1 is not returned (null is returned instead).This "Strict" version requires its input to be sorted, and no element may be missing.
This "Strict" version differs from the regular modulus by requiring that the argument be dense: that is, every pair of numbers in the argument array is separated by exactly the modulus.
The endpoints can be treated in two different ways: Either exactly like other numbers in the input, or they can merely be checked for the condition without the strict density requirement.
- Parameters:
nums
- array of operandsnonstrictEnds
- whether endpoints are NOT subject to the strict density requirement- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the array contains fewer than 3 elements
-
modulusStrictLong
public static long @Nullable @ArrayLen(2) [] modulusStrictLong(Iterator<Long> itor, boolean nonstrictEnds) The iterator produces Long values. This can be more efficient than modulus(long[]) if the long[] doesn't already exist, because this does not necessarily examine every value produced by its iterator.For documentation, see
modulusStrict(long[], boolean)
.- Parameters:
itor
- iterator of operands; modified by this methodnonstrictEnds
- whether endpoints are NOT subject to the strict density requirement- Returns:
- an array of two integers (r,m) such that each number in NUMS is equal to r (mod m), or null if no such exists or the iterator contains fewer than 3 elements
- See Also:
-
missingNumbers
@Pure @StaticallyExecutable public static int[] missingNumbers(int @MinLen(1) [] nums) Returns an array containing all the numbers not in its argument array (which must be non-empty) but in the argument's range; that is, bigger than its argument's minimum value and smaller than its argument's maximum value. The result contains no duplicates and is in order.- Parameters:
nums
- numbers to be excluded; length > 0; may contain duplicates- Returns:
- the set: [min(nums)..max(nums)] - nums
-
nonmodulusStrict
@Pure @StaticallyExecutable public static int @Nullable @ArrayLen(2) [] nonmodulusStrict(int[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are. Returns null if the input array has 0 length.- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
nonmodulusStrictInt
Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
nonmodulusNonstrict
@Pure @StaticallyExecutable public static int @Nullable @ArrayLen(2) [] nonmodulusNonstrict(int[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but for every number in NUMS, at least one is equal to every non-r remainder. The modulus is chosen as small as possible, but no greater than half the range of the input numbers (else null is returned).- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
missingNumbers
@Pure @StaticallyExecutable public static long[] missingNumbers(long @MinLen(1) [] nums) Returns an array containing all the numbers not in its argument array (which must be non-empty) but in the argument's range; that is, bigger than its argument's minimum value and smaller than its argument's maximum value. The result contains no duplicates and is in order.- Parameters:
nums
- numbers to be excluded; length > 0; may contain duplicates- Returns:
- the set: [min(nums)..max(nums)] - nums
-
nonmodulusStrict
@Pure @StaticallyExecutable public static long @Nullable @ArrayLen(2) [] nonmodulusStrict(long[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are. Returns null if the input array has 0 length.- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
nonmodulusStrictLong
Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but all missing numbers in their range are.- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
nonmodulusNonstrict
@Pure @StaticallyExecutable public static long @Nullable @ArrayLen(2) [] nonmodulusNonstrict(long[] nums) Returns a tuple of (r,m) where no number in NUMS is equal to r (mod m) but for every number in NUMS, at least one is equal to every non-r remainder. The modulus is chosen as small as possible, but no greater than half the range of the input numbers (else null is returned).- Parameters:
nums
- the list of operands- Returns:
- a (remainder, modulus) pair that fails to match elements of nums
-
modNonnegative(int, int)