Android Utililty Methods Little Endian Convert

List of utility methods to do Little Endian Convert

Description

The list of methods to do Little Endian Convert are organized into topic(s).

Method

byte[]charAsLittleEnd(byte[] a, int i, char v)
Convert a char value into an array in little-endian format, copying the result in the passed array at the point especified.
a[i + 1] = (byte) (0xFF & (v >> 8));
a[i + 0] = (byte) (0xFF & v);
return a;
byte[]charAsLittleEnd(char val)
Converts a char value to an array in little-endian format.
return shortAsLittleEnd((short) val);
byte[]intAsLittleEnd(byte[] a, int i, int v)
Convert an int value into an array in little-endian format, copying the result in the passed array at the point especified.
a[i + 3] = (byte) (0xFF & (v >> 24));
a[i + 2] = (byte) (0xFF & (v >> 16));
a[i + 1] = (byte) (0xFF & (v >> 8));
a[i + 0] = (byte) (0xFF & v);
return a;
byte[]intAsLittleEnd(int val)
Converts an int value to an array in little-endian format.
byte[] array = new byte[4];
return intAsLittleEnd(array, 0, val);
byte[]longAsLittleEnd(byte[] a, int i, long v)
Convert a long value into an array in little-endian format, copying the result in the passed array at the point especified.
a[i + 7] = (byte) (0xFF & (v >> 56));
a[i + 6] = (byte) (0xFF & (v >> 48));
a[i + 5] = (byte) (0xFF & (v >> 40));
a[i + 4] = (byte) (0xFF & (v >> 32));
a[i + 3] = (byte) (0xFF & (v >> 24));
a[i + 2] = (byte) (0xFF & (v >> 16));
a[i + 1] = (byte) (0xFF & (v >> 8));
a[i + 0] = (byte) (0xFF & v);
...
byte[]longAsLittleEnd(long val)
Converts a long value to an array in little-endian format.
byte[] array = new byte[8];
return longAsLittleEnd(array, 0, val);
byte[]shortAsLittleEnd(byte[] a, int i, short v)
Convert a short value into an array in little-endian format, copying the result in the passed array at the point especified.
a[i + 1] = (byte) (0xFF & (v >> 8));
a[i + 0] = (byte) (0xFF & v);
return a;
byte[]shortAsLittleEnd(short val)
Converts a short value to an array in little-endian format.
byte[] array = new byte[2];
return shortAsLittleEnd(array, 0, val);
intuint32LittleEndian(int value)
uint Little Endian
value = (int) ((long) value & 0xFFFFFFFF);
return swapBytes(value);