Package edu.cnm.deepdive
Class Radices
java.lang.Object
edu.cnm.deepdive.Radices
public class Radices extends Object
Defines the static method
toString(long, int)
, which constructs and returns a
representation of a long
value, using a specified int
radix (number
base). Implementation of this method is included in the Deep Dive Coding Java training programs.-
Method Summary
-
Method Details
-
toString
Constructs and returns a representation ofvalue
usingradix
as a number base. The characters used for the digits of the representation are'0'
through'9'
, supplemented (as necessary) by'a'
through'z'
(forradix > 10
). This gives a maximum of 36 digit characters; thus, anIllegalArgumentException
is thrown ifradix > 36
, or ifradix <= 1
. Ifvalue < 0
, then the representation returned is the same as the representation that would be returned forMath.abs(value)
, but with "-" prepended.- Parameters:
value
- Quantity to be represented usingradix
as a number base.radix
- Number base to use in the representation ofvalue
.- Returns:
- Representation of
value
usingradix
as a number base. - Throws:
IllegalArgumentException
- Ifradix <= 1
, or ifradix > 36
.
-