Here you can find the source of bytesToLong(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static long bytesToLong(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { /**/*ww w. j a va2 s . c o m*/ * Converts a byte array to a long number * @param bytes * @return long as bytes value */ public static long bytesToLong(byte[] bytes) { long n = ((long) (bytes[7])) & 0xFFL; n |= (((long) bytes[6]) << 8) & 0xFF00L; n |= (((long) bytes[5]) << 16) & 0xFF0000L; n |= (((long) bytes[4]) << 24) & 0xFF000000L; n |= (((long) bytes[3]) << 32) & 0xFF00000000L; n |= (((long) bytes[2]) << 40) & 0xFF0000000000L; n |= (((long) bytes[1]) << 48) & 0xFF000000000000L; n |= (((long) bytes[0]) << 56) & 0xFF00000000000000L; return n; } }