Package it.unimi.di.prog2.h15
Class DecimalDigits
java.lang.Object
it.unimi.di.prog2.h15.DecimalDigits
A class representing decimal digits of a long.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
The number whose digits are represented by this class. -
Constructor Summary
ConstructorsConstructorDescriptionDecimalDigits
(long number) Creates a new instance representing the digits of the given number. -
Method Summary
Modifier and TypeMethodDescriptionint
digit
(int power) Returns the digit corresponding to the given power of 10.
-
Field Details
-
number
private final long numberThe number whose digits are represented by this class.
-
-
Constructor Details
-
DecimalDigits
public DecimalDigits(long number) Creates a new instance representing the digits of the given number.- Parameters:
number
- the number.
-
-
Method Details
-
digit
public int digit(int power) Returns the digit corresponding to the given power of 10.- Parameters:
power
- the power.- Returns:
- the corresponding digit.
-