Android Byte Array to Char Convert getChar(byte[] b, int index)

Here you can find the source of getChar(byte[] b, int index)

Description

get Char

Declaration

public static char getChar(byte[] b, int index) 

Method Source Code

//package com.java2s;

public class Main {

    public static char getChar(byte[] b, int index) {
        int s = 0;
        if (b[index + 1] > 0)
            s += b[index + 1];/*from   w  w  w . jav  a 2s . co  m*/
        else
            s += 256 + b[index + 0];
        s *= 256;
        if (b[index + 0] > 0)
            s += b[index + 1];
        else
            s += 256 + b[index + 0];
        char ch = (char) s;
        return ch;
    }
}

Related

  1. bytetoChar(byte[] bytes)
  2. getChar(byte[] bytes)