Here you can find the source of arrayToDouble(final byte[] array, final int start)
double
, starting at an offset of start
.
Parameter | Description |
---|---|
array | a parameter |
start | a parameter |
public static double arrayToDouble(final byte[] array, final int start)
//package com.java2s; // it under the terms of the GNU General Public License as published by public class Main { private static final int MASK_FF = 0xff; /*********************************************************************************************** * Convert the contents of the specified array to a <code><b>double</b></code>, * starting at an offset of <code>start</code>. *//w ww.ja v a 2 s.co m * @param array * @param start * * @return double */ public static double arrayToDouble(final byte[] array, final int start) { int i; int count; long accum; final int length; final byte[] temp; count = 0; length = 8; temp = new byte[length]; for (i = start; i < (start + length); i++) { temp[count] = array[i]; count++; } accum = 0; i = 0; for (int shiftBy = 0; shiftBy < Double.SIZE; shiftBy += 8) { accum |= ((long) (temp[i] & MASK_FF)) << shiftBy; i++; } return (Double.longBitsToDouble(accum)); } }