code: public static int dehexchar(char c) {
  
          if ((c >= '0') && (c <= '9')) {
              return c - '0';
          }
          if ((c >= 'A') && (c <= 'F')) {
              return c - ('A' - 10);
          }
          if ((c >= 'a') && (c <= 'f')) {
              return c - ('a' - 10);
          }
          return -1;
      }
docs: Get the hex value of a character (base16).<p>
  
  @param c a character between '0' and '9' or between 'A' and 'F' or
  between 'a' and 'f'
  @return  an int between 0 and 15, or -1 if c was not a hex digit