Java tutorial
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.charset.Charset; public class Main { public static char[] getChars(byte[] buffer, int offset, int length) { ByteBuffer bb = ByteBuffer.allocate(length); bb.put(buffer, offset, length); bb.flip(); return Charset.defaultCharset().decode(bb).array(); } }