If character c is a hexadecimal digit, return accumulator 16 plus corresponding number. Otherwise return -1.
(int c, int accumulator)
| 70 | * corresponding number. Otherwise return -1. |
| 71 | */ |
| 72 | public static int xDigitToInt(int c, int accumulator) { |
| 73 | check: |
| 74 | { |
| 75 | // Use 0..9 < A..Z < a..z |
| 76 | if (c <= '9') { |
| 77 | c -= '0'; |
| 78 | if (0 <= c) { |
| 79 | break check; |
| 80 | } |
| 81 | } else if (c <= 'F') { |
| 82 | if ('A' <= c) { |
| 83 | c -= ('A' - 10); |
| 84 | break check; |
| 85 | } |
| 86 | } else if (c <= 'f') { |
| 87 | if ('a' <= c) { |
| 88 | c -= ('a' - 10); |
| 89 | break check; |
| 90 | } |
| 91 | } |
| 92 | return -1; |
| 93 | } |
| 94 | return (accumulator << 4) | c; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Add <i>listener</i> to <i>bag</i> of listeners. The function does not modify <i>bag</i> and |
no outgoing calls
no test coverage detected