Java Hex Convert To fromHexDigit(int c)

Here you can find the source of fromHexDigit(int c)

Description

from Hex Digit

License

Apache License

Declaration

private static int fromHexDigit(int c) throws NumberFormatException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static int fromHexDigit(int c) throws NumberFormatException {
        if (c >= 0x30 && c < 0x3A)
            return c - 0x30;
        else if (c >= 0x41 && c < 0x47)
            return c - 0x37;
        else if (c >= 0x61 && c < 0x67)
            return c - 0x57;
        else//from   ww w.j  a v a2  s .  c  om
            throw new NumberFormatException('\'' + c + "' is not a valid hexadecimal digit.");
    }
}

Related

  1. fromHexBinary(String s)
  2. fromHexChar(char ch)
  3. fromHexChars(char[] chars, int i)
  4. fromHexDigest(String hexDigest)
  5. fromHexDigit(final char c)
  6. fromHexNibble(char n)
  7. fromHexNibble(final char n)
  8. fromHexShort(char a)
  9. fromHexStr(final String data)