Here you can find the source of bytesToLong(byte[] b)
Parameter | Description |
---|---|
b | Bytes to convert to a long |
public static long bytesToLong(byte[] b)
//package com.java2s; /*// w w w .j av a2 s. c o m * This file is part of SpaceModule (http://spacebukkit.xereo.net/). * * SpaceModule is free software: you can redistribute it and/or modify it under the terms of the * Attribution-NonCommercial-ShareAlike Unported (CC BY-NC-SA) license as published by the Creative * Common organization, either version 3.0 of the license, or (at your option) any later version. * * SpaceBukkit 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 * Attribution-NonCommercial-ShareAlike Unported (CC BY-NC-SA) license for more details. * * You should have received a copy of the Attribution-NonCommercial-ShareAlike Unported (CC BY-NC-SA) * license along with this program. If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>. */ public class Main { /** * Converts a byte[] to a long * @param b Bytes to convert to a long * @return The byte[] in long form */ public static long bytesToLong(byte[] b) { long l = 0L; l = b[0]; l = (l << 8) | b[1]; l = (l << 8) | b[2]; l = (l << 8) | b[3]; l = (l << 8) | b[4]; l = (l << 8) | b[5]; l = (l << 8) | b[6]; l = (l << 8) | b[7]; return l; } }