Android Utililty Methods Array Convert

List of utility methods to do Array Convert

Description

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

Method

int[]convertByteArrayToIntArray(byte[] bytes)
Converts a byte array to an int array.
if (bytes == null)
    return null;
int count = bytes.length / 4;
int[] intArray = new int[count];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
for (int i = 0; i < count; i++) {
    intArray[i] = byteBuffer.getInt();
return intArray;
long[]convertByteArrayToLongArray(byte[] bytes)
Converts a byte array to a long array.
if (bytes == null)
    return null;
int count = bytes.length / 8;
long[] longArray = new long[count];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
for (int i = 0; i < count; i++) {
    longArray[i] = byteBuffer.getLong();
return longArray;
byte[]convertDoubleArrayToByteArray(double[] doubleArray)
Converts a double array to a byte array.
if (doubleArray == null)
    return null;
byte[] bytes = new byte[doubleArray.length * 8];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
for (double v : doubleArray) {
    byteBuffer.putDouble(v);
return bytes;
...
voidconvertDoubleConsonant(byte[] b)
convert Double Consonant
int len = b.length;
if ((len & 1) == 1) {
    b[len - 1] = '\0';
    len--;
for (int i = 0; i < len; i += 2) {
    int high = b[i] & 0xff;
    int low = b[i + 1] & 0xff;
...