Java Byte to Char byteToChar(byte aByte)

Here you can find the source of byteToChar(byte aByte)

Description

byte To Char

License

Open Source License

Declaration

public static char byteToChar(byte aByte) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static char byteToChar(byte aByte) {
        byte ref;
        if (aByte >= 0 && aByte <= 9) {
            ref = (byte) '0';
        } else if (aByte > 9 && aByte < 16) {
            ref = (byte) 'a' - 10;
        } else {/*  w  ww. j  a  va  2 s.c o m*/
            throw new IllegalArgumentException("The byte '" + aByte + "' cannot be converted to a char");
        }

        return (char) (aByte + ref);
    }
}

Related

  1. byteToChar(byte b)
  2. byteToChar(byte b_)
  3. byteToChar(byte c)
  4. byteToChar(byte chr)