code: private static int hexToInt(char c) {
          if ('0' <= c && c <= '9') {
              return c - '0';
          } else if ('a' <= c && c <= 'f') {
              return 10 + (c - 'a');
          } else if ('A' <= c && c <= 'F') {
              return 10 + (c - 'A');
          } else {
              return -1;
          }
      }
docs: Like {@link Character#digit}, but without support for non-ASCII
  characters.