Here you can find the source of toString(ByteBuffer bb)
public static String toString(ByteBuffer bb)
//package com.java2s; //License from project: LGPL import java.nio.ByteBuffer; public class Main { public static String toString(ByteBuffer bb) { StringBuilder sb = new StringBuilder(); while (bb.hasRemaining()) { sb.append((char) bb.get()); }/*ww w. j a v a2 s . com*/ return sb.toString(); } }