public static int parseHexDigit(int ch)
   {
      int b;

      try
      {
         b = HEX_MAP[ch];
      }

      catch (IndexOutOfBoundsException ex)
      {
         b = -1;
      }

      if (b == -1)
      {
         throw new IllegalArgumentException("Invalid hex digit " + ch);
      }

      return b;
   }