Converts a hex character to an integer value. @param ch character @return integer value, or -1 if the input is invalid
(final int ch)
| 1465 | * @return integer value, or {@code -1} if the input is invalid |
| 1466 | */ |
| 1467 | public static int dec(final int ch) { |
| 1468 | if(ch >= '0' && ch <= '9') return ch - '0'; |
| 1469 | if(ch >= 'a' && ch <= 'f' || ch >= 'A' && ch <= 'F') return (ch & 0x0F) + 9; |
| 1470 | return -1; |
| 1471 | } |
| 1472 | |
| 1473 | /** |
| 1474 | * Converts hex characters to an integer value. |