Here you can find the source of longFromBytes(byte[] bytes, int offset)
public static long longFromBytes(byte[] bytes, int offset)
//package com.java2s; /*//from w w w. j a v a2 s .com * JaamSim Discrete Event Simulation * Copyright (C) 2013 Ausenco Engineering Canada Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ public class Main { public static long longFromBytes(byte[] bytes, int offset) { long ret = 0; ret |= (bytes[offset + 0] & 0xFFL) << 56; ret |= (bytes[offset + 1] & 0xFFL) << 48; ret |= (bytes[offset + 2] & 0xFFL) << 40; ret |= (bytes[offset + 3] & 0xFFL) << 32; ret |= (bytes[offset + 4] & 0xFFL) << 24; ret |= (bytes[offset + 5] & 0xFFL) << 16; ret |= (bytes[offset + 6] & 0xFFL) << 8; ret |= (bytes[offset + 7] & 0xFFL); return ret; } }