Package it.unimi.di.prog2.h15.dd
Class DecimalDigits
java.lang.Object
it.unimi.di.prog2.h15.dd.DecimalDigits
A class representing decimal digits of a long.
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
number
private final long number
-
-
Constructor Details
-
DecimalDigits
public DecimalDigits(long 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.
-
main
This method serves the only purpose to show an usage example of this class.It prints the requested digit of a given number.
- Parameters:
args
- the first parametr is the number, the second the poisition of the digit to be printed.
-