Java Utililty Methods ByteOrder

List of utility methods to do ByteOrder

Description

The list of methods to do ByteOrder are organized into topic(s).

Method

inttoFloatByteArray(float val, ByteOrder outOrder, byte[] buf, int off)
to Float Byte Array
return toInt32ByteArray(Float.floatToIntBits(val), outOrder, buf, off);
inttoInt(byte[] bytes, ByteOrder order)
to Int
if (bytes == null) {
    throw new NullPointerException();
byte[] temp = subArray(bytes, 0, COUNT);
if (temp.length < COUNT) {
    temp = concat(new byte[COUNT - temp.length], temp);
int result = 0;
...
inttoInt16ByteArray(final int val, final ByteOrder outOrder, final byte[] buf, final int off)
to Int Byte Array
if (null == outOrder)
    throw new NumberFormatException("toInt16ByteArray(" + val + ") no order specified");
final boolean isBigEndian = ByteOrder.BIG_ENDIAN.equals(outOrder);
buf[off] = (byte) ((isBigEndian ? (val >> 8) : val) & 0x00FF);
buf[off + 1] = (byte) ((isBigEndian ? val : (val >> 8)) & 0x00FF);
return 2;
inttoInt64ByteArray(final long val, final ByteOrder outOrder, final byte[] buf)
to Int Byte Array
return toInt64ByteArray(val, outOrder, buf, 0);