Here you can find the source of printBuffer(ByteBuffer buffer)
public static void printBuffer(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.util.Arrays; public class Main { public static void printBuffer(ByteBuffer buffer) { byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes);//from w w w . ja va 2s . co m System.out.println(Arrays.toString(bytes)); } }