Here you can find the source of bytesToLongLittleEndian(final byte[] vals, final int from)
bytes
into single long
Parameter | Description |
---|---|
vals | raw data |
from | offset in array |
public static long bytesToLongLittleEndian(final byte[] vals, final int from)
//package com.java2s; public class Main { /**//from w w w .ja va 2 s . c om * <code>bytes</code> into single <code>long</code> * @param vals raw data * @param from offset in array * @return long */ public static long bytesToLongLittleEndian(final byte[] vals, final int from) { final int bot = (vals[from + 3] << 24) + ((vals[from + 2] & 0xFF) << 16) + ((vals[from + 1] & 0xFF) << 8) + (vals[from] & 0xFF); final int top = (vals[from + 7] << 24) + ((vals[from + 6] & 0xFF) << 16) + ((vals[from + 5] & 0xFF) << 8) + (vals[from + 4] & 0xFF); return ((long) top << 32) + ((long) bot & 0xFFFFFFFFL); } }