Here you can find the source of arrayToLong(final byte[] array, final int start)
long
, starting at an offset of start
.
Parameter | Description |
---|---|
array | a parameter |
start | a parameter |
public static long arrayToLong(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>long</b></code>, * starting at an offset of <code>start</code>. */* www .j av a 2s. c o m*/ * @param array * @param start * * @return long */ public static long arrayToLong(final byte[] array, final int start) { int i; int count; long accum; final int length; final byte[] temp; count = 0; length = 4; 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 < 32; shiftBy += 8) { accum |= ((long) (temp[i] & MASK_FF)) << shiftBy; i++; } return (accum); } }