List of usage examples for java.nio IntBuffer order
public abstract ByteOrder order();
From source file:Main.java
public static void main(String[] args) { IntBuffer bb = IntBuffer.allocate(10); bb.put(100);/*from w w w . j a v a 2s.c o m*/ System.out.println(bb.order()); }
From source file:de.ailis.threedee.utils.BufferUtils.java
/** * Converts the specified integer buffer to native endian and returns this * new buffer. If buffer is already in correct endian format then it is * returned right away.//from w w w .ja v a 2 s . c om * * @param buffer * The integer buffer to convert * @return The converted integer buffer or the source buffer if no * conversion is needed */ public static IntBuffer convertToNativeEndian(final IntBuffer buffer) { if (buffer.order() == ByteOrder.nativeOrder()) return buffer; final ByteBuffer bytes = ByteBuffer.allocateDirect(buffer.capacity()); bytes.order(ByteOrder.nativeOrder()); final IntBuffer ints = bytes.asIntBuffer(); ints.put(buffer).rewind(); return ints; }