Here you can find the source of getByteBuffer(int size)
public static ByteBuffer getByteBuffer(int size)
//package com.java2s; // See LICENSE.txt for license information import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { /** Returns a fully initialized empty {@link ByteBuffer} in little endian order. */ public static ByteBuffer getByteBuffer(int size) { return ByteBuffer.allocate(Math.max(0, size)).order(ByteOrder.LITTLE_ENDIAN); }//from w ww . j av a2 s . co m /** Returns a {@link ByteBuffer} based on {@code buffer} in little endian order. */ public static ByteBuffer getByteBuffer(byte[] buffer) { if (buffer == null) { buffer = new byte[0]; } return ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN); } }