Here you can find the source of toLong(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static final long toLong(byte[] bytes)
//package com.java2s; /**//from ww w. j ava2s . co m * This file is part of tera-api. * * tera-api 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. * * tera-api 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. * * You should have received a copy of the GNU General Public License * along with tera-api. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * @param bytes * @return */ public static final long toLong(byte[] bytes) { long result = 0; result += (bytes[3] & 0xFF); result += ((bytes[2] & 0xFF) << 8); result += ((bytes[1] & 0xFF) << 16); result += (bytes[0] << 24); return result & 0xFFFFFFFFl; } }