Java tutorial
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static String getString(ByteBuffer buf, int len) { char[] data = new char[len]; for (int i = 0; i < len; i++) { data[i] = buf.getChar(); } return new String(data); } }