Java Utililty Methods Char to Byte

List of utility methods to do Char to Byte

Description

The list of methods to do Char to Byte are organized into topic(s).

Method

bytecharToByte(char ch)
char To Byte
if (Character.isDigit(ch)) {
    return (byte) (ch - '0');
if (ch >= 'a' && ch <= 'f') {
    return (byte) (0xa + ch - 'a');
if (ch >= 'A' && ch <= 'F') {
    return (byte) (0xa + ch - 'A');
...
bytecharToByte(char encodedChar)
char To Byte
byte result = 0;
if (encodedChar != PADDING)
    result = (byte) (byteToCharMap.indexOf(encodedChar));
return result;
byte[]charToByte(char[] chars)
char To Byte
byte[] tempArray = new byte[chars.length];
for (int i = 0; i < chars.length; i++) {
    tempArray[i] = (byte) chars[i];
return tempArray;
byte[]charToByte(char[] tab)
char To Byte
byte[] result = new byte[tab.length];
for (int i = 0; i < tab.length; i++) {
    result[i] = (byte) tab[i];
return result;
byte[]charToByte(char[] values)
char To Byte
if (values == null) {
    return null;
byte[] results = new byte[values.length];
for (int i = 0; i < values.length; i++) {
    results[i] = (byte) values[i];
return results;
...
BytecharToByte(final char value)
char To Byte
return (byte) value;
byteconvertCharToByte(char firstChar, char secondChar)
convert Char To Byte
byte firstValue = (byte) convertCharToInt(firstChar);
byte secondValue = (byte) convertCharToInt(secondChar);
return (byte) ((byte) (firstValue << 4) | (byte) secondValue);
byte[]convertCharToByte(char[] from)
convert Char To Byte
int size = from.length;
byte[] to = new byte[size];
for (int i = 0; i < size; i++)
    to[i] = (byte) from[i]; 
return to;
byte[]convertCharToByte(char[] source, int srclen)
convert Char To Byte
if (source == null) {
    return null;
int len = source.length;
if (len > srclen) {
    len = srclen;
byte[] dest = new byte[len];
...
byte[]convertCharToBytes(char c)
convert Char To Bytes
byte[] b = new byte[2];
b[0] = (byte) ((c & 0xFF00) >>> 8);
b[1] = (byte) (c & 0xFF);
return b;