Android Byte Array to Double Convert convertByteArrayToDoubleArray(byte[] bytes)

Here you can find the source of convertByteArrayToDoubleArray(byte[] bytes)

Description

Converts a byte array to a double array.

License

Apache License

Parameter

Parameter Description
bytes a parameter

Declaration

public static double[] convertByteArrayToDoubleArray(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    /**//w  w w .  ja va  2  s .  c  om
     * Converts a byte array to a double array.
     * @param bytes
     * @return
     */
    public static double[] convertByteArrayToDoubleArray(byte[] bytes) {
        if (bytes == null)
            return null;

        int count = bytes.length / 8;
        double[] doubleArray = new double[count];
        ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
        for (int i = 0; i < count; i++) {
            doubleArray[i] = byteBuffer.getDouble();
        }
        return doubleArray;
    }
}

Related

  1. getDouble(byte[] buf, boolean bigEndian)
  2. getDouble(byte[] bytes)
  3. toDouble(byte[] b, int pos)
  4. toDouble(byte[] b, int pos, int width)
  5. byteToDouble(byte[] b)