Class LexicographicUtils


  • public class LexicographicUtils
    extends Object
    A utility class for converting non-string values into string values with a lexicographic order that preserves the orginal order of the values. Hence, if 6 < 13, this utility class can convert 6 and 13 such that the resulting string values will exhibit a lexicographic order whereby the string representation of 6 will still be less than 13.
    • Constructor Detail

      • LexicographicUtils

        public LexicographicUtils()
    • Method Detail

      • intAsString

        public static String intAsString​(int i,
                                         int strSize)
        A string representation of the integer that honours lexicographical order. If a strSize is specified that is less than the minimum number of characters required to represent the integer as a string, the integer string is returned as is.
        Parameters:
        i - the integer
        strSize - size/length of the string to return (appropriate 0's will be appended to the left to make the specified size)
        Returns:
        a string representation of the integer that honours lexicographical order.