Class IDBaseConverter


  • public class IDBaseConverter
    extends java.lang.Object
    A class for handling the input and output of ids at certain bases.
    • Constructor Summary

      Constructors 
      Constructor Description
      IDBaseConverter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getMaxId​(int base)
      Returns the largest integer representing a valid id by the given base.
      static void init()  
      static int parse​(java.lang.String str, int base)
      Parses a String and interprets it as a number in the base that is given.
      static java.lang.String toString​(int id, int base)
      Returns a string representation of id in the requested base.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IDBaseConverter

        public IDBaseConverter()
    • Method Detail

      • parse

        public static int parse​(java.lang.String str,
                                int base)
                         throws java.lang.NumberFormatException
        Parses a String and interprets it as a number in the base that is given.
        Parameters:
        str - the string to parse.
        base - the radix used for parsing the string
        Returns:
        a decimal integer representation of the string.
        Throws:
        java.lang.NumberFormatException - If str is null or of zero length or cannot be interpreted in the current base.
      • toString

        public static java.lang.String toString​(int id,
                                                int base)
        Returns a string representation of id in the requested base. For clarity lowercase 'l's are converted to uppercase.
        Parameters:
        id - the id to convert.
        base - the radix used for conversion
        Returns:
        the String representation of id.
      • getMaxId

        public static int getMaxId​(int base)
        Returns the largest integer representing a valid id by the given base.
        Parameters:
        base -
      • init

        public static void init()