Here you can find the source of getLongB(ByteBuffer bb, int index)
private static long getLongB(ByteBuffer bb, int index)
//package com.java2s; /**/*from w w w . j a va2s .co m*/ * Copyright 2007-2016, Kaazing Corporation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.nio.ByteBuffer; public class Main { private static long getLongB(ByteBuffer bb, int index) { return makeLong(bb.get(index), bb.get(index + 1), bb.get(index + 2), bb.get(index + 3), bb.get(index + 4), bb.get(index + 5), bb.get(index + 6), bb.get(index + 7)); } private static long makeLong(byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1, byte b0) { return (long) b7 << 56 | ((long) b6 & 0xff) << 48 | ((long) b5 & 0xff) << 40 | ((long) b4 & 0xff) << 32 | ((long) b3 & 0xff) << 24 | ((long) b2 & 0xff) << 16 | ((long) b1 & 0xff) << 8 | (long) b0 & 0xff; } }