Java Hex Calculate toHexDigit(char ch, int index)

Here you can find the source of toHexDigit(char ch, int index)

Description

to Hex Digit

License

Apache License

Declaration

protected static int toHexDigit(char ch, int index) throws RuntimeException 

Method Source Code

//package com.java2s;
/*//w w w.  j  a  va 2 s. c  o m
 *  Copyright Gergely Nagy <greg@webhejj.hu>
 *
 *  Licensed under the Apache License, Version 2.0; 
 *  you may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 */

public class Main {
    protected static int toHexDigit(char ch, int index) throws RuntimeException {
        int digit = Character.digit(ch, 16);
        if (digit == -1) {
            throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index);
        }
        return digit;
    }
}

Related

  1. toHexChars(byte[] bs)
  2. toHexChars(byte[] bytes)
  3. toHexChars(final int b)
  4. toHexDec(byte[] bytes)
  5. toHexDigit(char ch)
  6. toHexDigit(int d)
  7. toHexDigit(int d)
  8. toHexDigit(int h)
  9. toHexDigit(int i)