Here you can find the source of toString(ByteBuffer sequence)
public static String toString(ByteBuffer sequence)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**// w ww . ja va 2 s.co m * Convert a byte buffer to a string in platform default encoding. */ public static String toString(ByteBuffer sequence) { return new String(sequence.array(), sequence.position(), sequence.remaining()); } }