- static boolean ishex(int c) {
- if ('0' <= c && c <= '9')
- return true;
- if ('a' <= c && c <= 'f')
- return true;
- if ('A' <= c && c <= 'F')
- return true;
- return false;
- }
-
- static boolean ishex(String s) {
- for (int i = 0; i < s.length(); i++)
- if (!ishex(s.charAt(i)))
- return false;
- return true;
- }
- static boolean isspace(int c) {
- switch (c) {
- case ' ':
- case '\t':
- return true;
- }
- return false;
- }
-
- static int fromhex(int c) {
- if ('0' <= c && c <= '9')
- return c - '0';
- if ('a' <= c && c <= 'f')
- return c - 'a' + 10;
- if ('A' <= c && c <= 'F')
- return c - 'A' + 10;
- return -1;
- }
-