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 Details

    • toString

      public static String toString​(long value, int radix) throws IllegalArgumentException
      Constructs and returns a representation of value using radix as a number base. The characters used for the digits of the representation are '0' through '9', supplemented (as necessary) by 'a' through 'z' (for radix > 10). This gives a maximum of 36 digit characters; thus, an IllegalArgumentException is thrown if radix > 36, or if radix <= 1. If value < 0, then the representation returned is the same as the representation that would be returned for Math.abs(value), but with "-" prepended.
      Parameters:
      value - Quantity to be represented using radix as a number base.
      radix - Number base to use in the representation of value.
      Returns:
      Representation of value using radix as a number base.
      Throws:
      IllegalArgumentException - If radix <= 1, or if radix > 36.