Here you can find the source of toLong(final byte[] data)
Parameter | Description |
---|---|
data | 8-byte array in big-endian format. |
public static long toLong(final byte[] data)
//package com.java2s; /* See LICENSE for licensing and NOTICE for copyright. */ public class Main { /**//from www . j a va2 s. c o m * Converts the big-endian representation of a 64-bit integer to the * equivalent long value. * * @param data 8-byte array in big-endian format. * * @return Long integer value. */ public static long toLong(final byte[] data) { return ((long) data[0] << 56) | (((long) data[1] & 0xff) << 48) | (((long) data[2] & 0xff) << 40) | (((long) data[3] & 0xff) << 32) | (((long) data[4] & 0xff) << 24) | (((long) data[5] & 0xff) << 16) | (((long) data[6] & 0xff) << 8) | ((long) data[7] & 0xff); } }