Java Byte Array to Char bytesToChar(byte[] bytes)

Here you can find the source of bytesToChar(byte[] bytes)

Description

bytes To Char

License

Open Source License

Declaration

public static char[] bytesToChar(byte[] bytes) 

Method Source Code

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

public class Main {
    public static char[] bytesToChar(byte[] bytes) {
        char[] buffer = new char[bytes.length >> 1];
        for (int i = 0; i < buffer.length; i++) {
            int bpos = i << 1;
            char c = (char) (((bytes[bpos] & 0x00FF) << 8) + (bytes[bpos + 1] & 0x00FF));
            buffer[i] = c;/*from w ww. j a  v a 2 s  . c o m*/
        }
        return buffer;
    }
}

Related

  1. bufferToChar(byte[] ioBuffer)
  2. bytesToChar(byte[] arr, int offset)
  3. bytesToChar(byte[] arr, int pos)
  4. bytesToChar(byte[] b)
  5. bytesToChar(byte[] bytes)
  6. bytesToChar(byte[] bytes)
  7. convertByteToChar(byte input)
  8. convertByteToChar(byte[] source, int srclen)
  9. convertByteToCharArray(byte aByte)