List of usage examples for java.nio FloatBuffer order
public abstract ByteOrder order();
From source file:Main.java
public static void main(String[] args) { FloatBuffer floatBuffer = FloatBuffer.allocate(10); floatBuffer.put(1, 1.23F);//from www. j av a 2 s. co m System.out.println(floatBuffer.order()); }
From source file:de.ailis.threedee.utils.BufferUtils.java
/** * Converts the specified float 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 . j a v a2 s.c o m * * @param buffer * The float buffer to convert * @return The converted float buffer or the source buffer if no conversion * is needed */ public static FloatBuffer convertToNativeEndian(final FloatBuffer buffer) { if (buffer.order() == ByteOrder.nativeOrder()) return buffer; if (log.isTraceEnabled()) log.trace("Converting endianess of " + buffer.capacity() + " floats"); final ByteBuffer bytes = ByteBuffer.allocateDirect(buffer.capacity()); bytes.order(ByteOrder.nativeOrder()); final FloatBuffer floats = bytes.asFloatBuffer(); floats.put(buffer).rewind(); return floats; }