Java Hex Convert To fromHexNibble(char n)

Here you can find the source of fromHexNibble(char n)

Description

Convert a hexadecimal digit to a byte.

License

Open Source License

Declaration

private static byte fromHexNibble(char n) 

Method Source Code

//package com.java2s;
//License from project: GNU General Public License 

public class Main {
    /**//  w w w  .  java2s  .c  om
     * Convert a hexadecimal digit to a byte.
     */
    private static byte fromHexNibble(char n) {
        if (n <= '9')
            return (byte) (n - '0');

        if (n <= 'G')
            return (byte) (n - ('A' - 10));

        return (byte) (n - ('a' - 10));
    }
}

Related

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