Java Hex Convert To fromHex(char c)

Here you can find the source of fromHex(char c)

Description

from Hex

License

Open Source License

Declaration

public static int fromHex(char c) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int fromHex(char c) {
        if (c >= '0' && c <= '9') {
            return c - '0';
        }//from   ww w  . j  a  va 2 s. c  om
        if (c >= 'A' && c <= 'F') {
            return c - 'A' + 10;
        }
        if (c >= 'a' && c <= 'f') {
            return c - 'a' + 10;
        }
        throw new IllegalArgumentException();
    }
}

Related

  1. convertHextoASCII(String text)
  2. convertHexToChar(String hex)
  3. convertHexToFloat(long hexValue)
  4. fromHex(byte[] hex)
  5. fromHex(char c)
  6. fromHex(char hi, char lo)
  7. fromHex(CharSequence cs)
  8. fromHex(final CharSequence s)
  9. fromHex(final String hex)