- All Superinterfaces:
Comparable<RealNumber>,Number,RationalNumber,RealNumber
- All Known Subinterfaces:
AtLeast<N>,AtLeastEight,AtLeastEighteen,AtLeastEleven,AtLeastFifteen,AtLeastFive,AtLeastFour,AtLeastFourteen,AtLeastMinusOne,AtLeastNine,AtLeastNineteen,AtLeastOne,AtLeastSeven,AtLeastSeventeen,AtLeastSix,AtLeastSixteen,AtLeastTen,AtLeastThirteen,AtLeastThree,AtLeastTwelve,AtLeastTwenty,AtLeastTwo,AtLeastZero,AtMost<N>,AtMostEight,AtMostEighteen,AtMostEleven,AtMostFifteen,AtMostFive,AtMostFour,AtMostFourteen,AtMostMinusOne,AtMostNine,AtMostNineteen,AtMostOne,AtMostSeven,AtMostSeventeen,AtMostSix,AtMostSixteen,AtMostTen,AtMostThirteen,AtMostThree,AtMostTwelve,AtMostTwenty,AtMostTwo,AtMostZero,FourOrEight,NaturalNumber,NMinus1<N>,NPlus1<N>,PositiveInteger
- All Known Implementing Classes:
ConcreteNumber,Eight,Eighteen,Eleven,Fifteen,Five,Four,Fourteen,MinusOne,Nine,Nineteen,One,Seven,Seventeen,Six,Sixteen,Ten,Thirteen,Three,Twelve,Twenty,Two,Zero
public sealed interface Integer
extends RationalNumber
permits NaturalNumber, ConcreteNumber, AtLeast<N>, AtMost<N>, NMinus1<N>, NPlus1<N>, AtLeastMinusOne, AtMostTwenty (not exhaustive)
Any integer number such as -12, 14, 0, 1 google, etc.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thisIntegeras aBigIntegerdefault intReturns aStreamconsisting of allIntegers in the range from thisIntegerto the givenIntegerdefault OneReturn the denominatordefault IntegerReturns the quotient of dividing thisIntegerby the givenIntegerdefault doubleReturns thisRealNumber's value with double-precision type.static booleanReturns true if the givenIntegers are equal, false otherwisedefault booleanReturns true if thisIntegeris greater than the givenInteger, false otherwisedefault booleanReturns true if thisIntegeris greater than the givenInteger, false otherwisedefault intReturns the denominator as a primitive int or throws an exception if its not in the range of primitive intsdefault intReturns the numerator as a primitive int or throws an exception if its not in the range of primitive intsintintValue()Returns the value of thisIntegeras a primitive int or throws an Exception if its not within int range.default booleanReturns true if thisIntegeris less than the givenInteger, false otherwisedefault booleanReturns true if thisIntegeris less than the givenInteger, false otherwisedefault longReturns the denominator as a primitive long or throws an Exception if its not in the range of primitive longsdefault longReturns the numerator as a primitive long or throws an Exception if its not in the range of primitive longslongReturns the value of thisIntegeras a primitive long or throws an Exception if its not within the range of long ints.default IntegerReturns the difference between thisIntegerand the givenIntegerdefault IntegerReturns the remainder of dividing thisIntegerby the givenIntegerdefault IntegerReturn the numeratorstatic Integerof(int i) Returns anIntegerwhose value is the givenintstatic Integerof(long i) Returns anIntegerwhose value is the givenlongstatic Integerof(BigInteger value) Creates a newIntegerwhose value is the givenBigIntegerstatic IntegerCreates a newIntegerfrom the given string or throws anExceptionif the string does not represent aInteger.default IntegerReturns the sum of thisIntegerand the givenIntegerdefault IntegerReturns the product of thisIntegerand the givenIntegerstatic StringReturns a binary string representation of the givenIntegerMethods inherited from interface org.zfcj.math.numbers.RationalNumber
dividedBy, isInt, isLong, minus, plus, reduce, timesMethods inherited from interface org.zfcj.math.numbers.RealNumber
abs, almostEquals, almostEquals, bigDecimalValue, dividedBy, greaterThan, greaterThanOrEqualTo, isDouble, lessThan, lessThanOrEqualTo, minus, modulo, plus, pow, times, truncate
-
Method Details
-
intValue
int intValue()Returns the value of thisIntegeras a primitive int or throws an Exception if its not within int range.- Returns:
- an int that represents this integer
-
longValue
long longValue()Returns the value of thisIntegeras a primitive long or throws an Exception if its not within the range of long ints.- Returns:
- a long that represents this integer
-
bigIntegerValue
BigInteger bigIntegerValue()Returns the value of thisIntegeras aBigInteger- Returns:
- this
Integer'sBigIntegervalue
-
numerator
Description copied from interface:RationalNumberReturn the numerator- Specified by:
numeratorin interfaceRationalNumber- Returns:
- the numerator
-
denominator
Description copied from interface:RationalNumberReturn the denominator- Specified by:
denominatorin interfaceRationalNumber- Returns:
- the denominator
-
intNumerator
default int intNumerator()Description copied from interface:RationalNumberReturns the numerator as a primitive int or throws an exception if its not in the range of primitive ints- Specified by:
intNumeratorin interfaceRationalNumber- Returns:
- the numerator as an int
-
intDenominator
default int intDenominator()Description copied from interface:RationalNumberReturns the denominator as a primitive int or throws an exception if its not in the range of primitive ints- Specified by:
intDenominatorin interfaceRationalNumber- Returns:
- the numerator as an int
-
longNumerator
default long longNumerator()Description copied from interface:RationalNumberReturns the numerator as a primitive long or throws an Exception if its not in the range of primitive longs- Specified by:
longNumeratorin interfaceRationalNumber- Returns:
- the numerator as an long
-
longDenominator
default long longDenominator()Description copied from interface:RationalNumberReturns the denominator as a primitive long or throws an Exception if its not in the range of primitive longs- Specified by:
longDenominatorin interfaceRationalNumber- Returns:
- the denominator as an long
-
doubleValue
default double doubleValue()Description copied from interface:RealNumberReturns thisRealNumber's value with double-precision type. Note that the value will be an approximation for irrational numbers such as Pi, Phi, e or repeating decimals such as 0.666..., 1.851851851..., etc.- Specified by:
doubleValuein interfaceRealNumber- Returns:
- the double value that is the closest approximation to this real number
-
plus
Returns the sum of thisIntegerand the givenInteger- Parameters:
i- the integer to sum- Returns:
- the sum of integers
-
minus
Returns the difference between thisIntegerand the givenInteger- Parameters:
i- the integer to subtract- Returns:
- the difference of integers
-
times
Returns the product of thisIntegerand the givenInteger- Parameters:
i- the integer to multiply- Returns:
- the product of integers
-
divide
Returns the quotient of dividing thisIntegerby the givenInteger- Parameters:
i- the integer to divide by- Returns:
- the quotient of integers
-
modulo
Returns the remainder of dividing thisIntegerby the givenInteger- Parameters:
i- the integer to modulo by- Returns:
- the remainder of dividing integers
-
lessThan
Returns true if thisIntegeris less than the givenInteger, false otherwise- Parameters:
i- the integer to test- Returns:
- the truth of this integer being less than the given integer
-
lessThanOrEqualTo
Returns true if thisIntegeris less than the givenInteger, false otherwise- Parameters:
i- the integer to test- Returns:
- the truth of this integer being less than or equal to the given integer
-
greaterThan
Returns true if thisIntegeris greater than the givenInteger, false otherwise- Parameters:
i- the integer to test- Returns:
- the truth of this integer being greater than the given integer
-
greaterThanOrEqualTo
Returns true if thisIntegeris greater than the givenInteger, false otherwise- Parameters:
i- the integer to test- Returns:
- the truth of this integer being greater than or equal to the given integer
-
compareTo
- Specified by:
compareToin interfaceComparable<RealNumber>- Specified by:
compareToin interfaceRealNumber
-
countTo
Returns aStreamconsisting of allIntegers in the range from thisIntegerto the givenInteger- Parameters:
i- theIntegerto count to- Returns:
- a stream of
Integerss
-
of
Returns anIntegerwhose value is the givenint- Parameters:
i- the int value- Returns:
- an
Integerwith value i
-
of
Returns anIntegerwhose value is the givenlong- Parameters:
i- the long value- Returns:
- an
Integerwith value i
-
of
Creates a newIntegerwhose value is the givenBigInteger- Parameters:
value- theBigIntegervalue- Returns:
- an
Integerwith the given value
-
equals
Returns true if the givenIntegers are equal, false otherwise- Parameters:
a- the first integerb- the second integer- Returns:
- true if the integers are equal, otherwise false
-
toBinaryString
Returns a binary string representation of the givenInteger- Parameters:
i- theInteger- Returns:
- a binary string representation of the
Integer
-
parse
Creates a newIntegerfrom the given string or throws anExceptionif the string does not represent aInteger.- Parameters:
s- the "integer" string- Returns:
- an
Integerthat represents the given string
-