Class HexEncoder


  • public final class HexEncoder
    extends java.lang.Object
    A helper class to create hex-encoded representations of numbers.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HexEncoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String encode​(int c)
      Returns an hex encoding of the given character as: 4-character string in case of non-BMP character 6-character string in case of BMP character
      static java.lang.String encode​(int n, int width)
      Returns an hex encoding of the given number as a string of the given length, left-padded with zeros if necessary.
      • Methods inherited from class java.lang.Object

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

      • HexEncoder

        private HexEncoder()
    • Method Detail

      • encode

        public static java.lang.String encode​(int n,
                                              int width)
        Returns an hex encoding of the given number as a string of the given length, left-padded with zeros if necessary.
        Parameters:
        n - a number
        width - required length of the string
        Returns:
        an hex-encoded representation of the number
      • encode

        public static java.lang.String encode​(int c)
        Returns an hex encoding of the given character as:
        • 4-character string in case of non-BMP character
        • 6-character string in case of BMP character
        Parameters:
        c - a character
        Returns:
        an hex-encoded representation of the character