Here you can find the source of ConvToByteBuffer(byte buf[])
public static ByteBuffer ConvToByteBuffer(byte buf[])
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static ByteBuffer ConvToByteBuffer(byte buf[]) { ByteBuffer ReturnBuffer = ByteBuffer.allocateDirect(buf.length); ReturnBuffer.order(ByteOrder.nativeOrder()); ReturnBuffer.put(buf);//from w ww.jav a 2s.co m ReturnBuffer.position(0); return ReturnBuffer; } }