Java examples for java.nio:ByteBuffer Endian
ByteBuffer big Endian Allocate
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static void main(String[] argv) throws Exception { int capacity = 2; System.out.println(bigEndianAllocate(capacity)); }//from w ww .j a va 2 s .c om /** * @param capacity is the size of buffer * @return a bigEndian ByteBuffer * @see java.nio.ByteBuffer#allocate(int) */ public static ByteBuffer bigEndianAllocate(int capacity) { ByteBuffer buf = ByteBuffer.allocate(capacity); buf.order(ByteOrder.BIG_ENDIAN); return buf; } }