Here you can find the source of toCharArray(byte[] src)
public static char[] toCharArray(byte[] src)
//package com.java2s; // The MIT License (MIT) public class Main { public static char[] toCharArray(byte[] src) { char[] arr = new char[src.length / 2]; for (int i = 0; i < arr.length; i++) { arr[i] = (char) (((0xff & (src[i * 2])) << 8) | (0xff & src[i * 2 + 1])); }// w ww.j av a 2 s.c om return arr; } }