Java ByteBuffer to Long Array getLongBE(ByteBuffer b, int start, int end)

Here you can find the source of getLongBE(ByteBuffer b, int start, int end)

Description

get Long BE

License

Open Source License

Declaration

public static long getLongBE(ByteBuffer b, int start, int end) 

Method Source Code

//package com.java2s;
/*/*from  w w  w . j  av a  2  s. c  o  m*/
 * Entagged Audio Tag library
 * Copyright (c) 2003-2005 Rapha?l Slinckx <raphael@slinckx.net>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *  
 * This library 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
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

import java.nio.ByteBuffer;

public class Main {
    public static long getLongBE(ByteBuffer b, int start, int end) {
        int number = 0;
        for (int i = 0; i < (end - start + 1); i++) {
            number += ((b.get(end - i) & 0xFF) << i * 8);
        }

        return number;
    }
}

Related

  1. getLong(ByteBuffer buffer)
  2. getLong(ByteBuffer byteBuffer, int longIndex)
  3. getLong(ByteBuffer in)
  4. getLong(ByteBuffer longCalculator, byte[] bytes)
  5. getLongB(ByteBuffer bb, int index)
  6. getLongByteBuffer(long id)
  7. getLongFromBuffer(ByteBuffer buffer, int offset, int size)
  8. getLongFromByteBuffer(ByteBuffer data)
  9. getLongLE(final ByteBuffer b, final int start, final int end)