Interface Integer

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 Details

    • intValue

      int intValue()
      Returns the value of this Integer as 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 this Integer as 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 this Integer as a BigInteger
      Returns:
      this Integer's BigInteger value
    • numerator

      default Integer numerator()
      Description copied from interface: RationalNumber
      Return the numerator
      Specified by:
      numerator in interface RationalNumber
      Returns:
      the numerator
    • denominator

      default One denominator()
      Description copied from interface: RationalNumber
      Return the denominator
      Specified by:
      denominator in interface RationalNumber
      Returns:
      the denominator
    • intNumerator

      default int intNumerator()
      Description copied from interface: RationalNumber
      Returns the numerator as a primitive int or throws an exception if its not in the range of primitive ints
      Specified by:
      intNumerator in interface RationalNumber
      Returns:
      the numerator as an int
    • intDenominator

      default int intDenominator()
      Description copied from interface: RationalNumber
      Returns the denominator as a primitive int or throws an exception if its not in the range of primitive ints
      Specified by:
      intDenominator in interface RationalNumber
      Returns:
      the numerator as an int
    • longNumerator

      default long longNumerator()
      Description copied from interface: RationalNumber
      Returns the numerator as a primitive long or throws an Exception if its not in the range of primitive longs
      Specified by:
      longNumerator in interface RationalNumber
      Returns:
      the numerator as an long
    • longDenominator

      default long longDenominator()
      Description copied from interface: RationalNumber
      Returns the denominator as a primitive long or throws an Exception if its not in the range of primitive longs
      Specified by:
      longDenominator in interface RationalNumber
      Returns:
      the denominator as an long
    • doubleValue

      default double doubleValue()
      Description copied from interface: RealNumber
      Returns this RealNumber'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:
      doubleValue in interface RealNumber
      Returns:
      the double value that is the closest approximation to this real number
    • plus

      default Integer plus(Integer i)
      Returns the sum of this Integer and the given Integer
      Parameters:
      i - the integer to sum
      Returns:
      the sum of integers
    • minus

      default Integer minus(Integer i)
      Returns the difference between this Integer and the given Integer
      Parameters:
      i - the integer to subtract
      Returns:
      the difference of integers
    • times

      default Integer times(Integer i)
      Returns the product of this Integer and the given Integer
      Parameters:
      i - the integer to multiply
      Returns:
      the product of integers
    • divide

      default Integer divide(Integer i)
      Returns the quotient of dividing this Integer by the given Integer
      Parameters:
      i - the integer to divide by
      Returns:
      the quotient of integers
    • modulo

      default Integer modulo(Integer i)
      Returns the remainder of dividing this Integer by the given Integer
      Parameters:
      i - the integer to modulo by
      Returns:
      the remainder of dividing integers
    • lessThan

      default boolean lessThan(Integer i)
      Returns true if this Integer is less than the given Integer, false otherwise
      Parameters:
      i - the integer to test
      Returns:
      the truth of this integer being less than the given integer
    • lessThanOrEqualTo

      default boolean lessThanOrEqualTo(Integer i)
      Returns true if this Integer is less than the given Integer, false otherwise
      Parameters:
      i - the integer to test
      Returns:
      the truth of this integer being less than or equal to the given integer
    • greaterThan

      default boolean greaterThan(Integer i)
      Returns true if this Integer is greater than the given Integer, false otherwise
      Parameters:
      i - the integer to test
      Returns:
      the truth of this integer being greater than the given integer
    • greaterThanOrEqualTo

      default boolean greaterThanOrEqualTo(Integer i)
      Returns true if this Integer is greater than the given Integer, false otherwise
      Parameters:
      i - the integer to test
      Returns:
      the truth of this integer being greater than or equal to the given integer
    • compareTo

      default int compareTo(RealNumber n)
      Specified by:
      compareTo in interface Comparable<RealNumber>
      Specified by:
      compareTo in interface RealNumber
    • countTo

      default Stream<Integer> countTo(Integer i)
      Returns a Stream consisting of all Integers in the range from this Integer to the given Integer
      Parameters:
      i - the Integer to count to
      Returns:
      a stream of Integerss
    • of

      static Integer of(int i)
      Returns an Integer whose value is the given int
      Parameters:
      i - the int value
      Returns:
      an Integer with value i
    • of

      static Integer of(long i)
      Returns an Integer whose value is the given long
      Parameters:
      i - the long value
      Returns:
      an Integer with value i
    • of

      static Integer of(BigInteger value)
      Creates a new Integer whose value is the given BigInteger
      Parameters:
      value - the BigInteger value
      Returns:
      an Integer with the given value
    • equals

      static boolean equals(Integer a, Integer b)
      Returns true if the given Integers are equal, false otherwise
      Parameters:
      a - the first integer
      b - the second integer
      Returns:
      true if the integers are equal, otherwise false
    • toBinaryString

      static String toBinaryString(Integer i)
      Returns a binary string representation of the given Integer
      Parameters:
      i - the Integer
      Returns:
      a binary string representation of the Integer
    • parse

      static Integer parse(String s)
      Creates a new Integer from the given string or throws an Exception if the string does not represent a Integer.
      Parameters:
      s - the "integer" string
      Returns:
      an Integer that represents the given string