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 long bytesToChar(byte[] bytes) 

Method Source Code

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

public class Main {
    public static long bytesToChar(byte[] bytes) {
        if (bytes == null || bytes.length == 0)
            return 0;
        char val = 0;
        for (int i = 0; i < 2 && i < bytes.length; i++) {
            val |= (char) (bytes[i] & 0xff) << (i * 8);
        }//from w ww  .  j a  v a 2  s  .com
        return val;
    }
}

Related

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