Java Char to Byte convertCharToByte(char firstChar, char secondChar)

Here you can find the source of convertCharToByte(char firstChar, char secondChar)

Description

convert Char To Byte

License

Open Source License

Declaration

public static byte convertCharToByte(char firstChar, char secondChar) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte convertCharToByte(char firstChar, char secondChar) {
        byte firstValue = (byte) convertCharToInt(firstChar);
        byte secondValue = (byte) convertCharToInt(secondChar);
        return (byte) ((byte) (firstValue << 4) | (byte) secondValue);
    }//from  w w  w . ja v a2 s .  co  m

    public static int convertCharToInt(char input) {
        if ((int) input >= (int) 'A') {
            return ((int) input - (int) 'A' + 10);
        } else {
            return ((int) input - (int) '0');
        }
    }
}

Related

  1. charToByte(char encodedChar)
  2. charToByte(char[] chars)
  3. charToByte(char[] tab)
  4. charToByte(char[] values)
  5. charToByte(final char value)
  6. convertCharToByte(char[] from)
  7. convertCharToByte(char[] source, int srclen)
  8. convertCharToBytes(char c)