Here you can find the source of convertByteToChar(byte[] source, int srclen)
public static char[] convertByteToChar(byte[] source, int srclen)
//package com.java2s; public class Main { public static char[] convertByteToChar(byte[] source, int srclen) { if (source == null) { return null; }//from w ww.ja v a 2s . c om int len = source.length; if (len > srclen) { len = srclen; } char[] destChar = new char[len]; for (int i = 0; i < len; i++) { if (source[i] >= 0) { destChar[i] = (char) source[i]; } else { destChar[i] = (char) (256 + source[i]); } } return destChar; } }