Java Byte to Char byteToChar(byte chr)

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

Description

byte To Char

License

Apache License

Declaration

public static final char byteToChar(byte chr) 

Method Source Code

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

public class Main {
    private static final char[] BYTE2CHAR = new char[256];

    public static final char byteToChar(byte chr) {
        // return (chr > 0x20 && chr < 0x7F) ? (char) chr : '.';
        return BYTE2CHAR[getUnsignedByte(chr)];
    }//from w  ww  .j a v a2s .  co  m

    public static short getUnsignedByte(int value) {
        return (short) (value & 0xFF);
    }
}

Related

  1. byteToChar(byte aByte)
  2. byteToChar(byte b)
  3. byteToChar(byte b_)
  4. byteToChar(byte c)
  5. byteToChar(byte[] bytes)
  6. byteToChar(int b, char unprintable)
  7. ByteToSafeChar(byte _bt)
  8. charAt(byte[] b, int s)