Java Char to Byte char2byte(char ch)

Here you can find the source of char2byte(char ch)

Description

charbyte

License

Apache License

Declaration

private static byte char2byte(char ch) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static byte char2byte(char ch) {
        switch (ch) {
        case '0':
            return 0x00;
        case '1':
            return 0x01;
        case '2':
            return 0x02;
        case '3':
            return 0x03;
        case '4':
            return 0x04;
        case '5':
            return 0x05;
        case '6':
            return 0x06;
        case '7':
            return 0x07;
        case '8':
            return 0x08;
        case '9':
            return 0x09;
        case 'A':
            return 0x0A;
        case 'B':
            return 0x0B;
        case 'C':
            return 0x0C;
        case 'D':
            return 0x0D;
        case 'E':
            return 0x0E;
        case 'F':
            return 0x0F;
        default://from   ww  w.  j  a v  a 2 s . c o m
            return 0x00;
        }
    }
}

Related

  1. char2bb(char[] c)
  2. char2Byte(char c)
  3. char2Byte(char ch)
  4. charToByte(char aChar)
  5. charToByte(char c)
  6. charToByte(char c)