Android Byte Array to Long Convert bytesToLong(byte[] bytes, int start)

Here you can find the source of bytesToLong(byte[] bytes, int start)

Description

bytes To Long

License

Open Source License

Declaration

public static long bytesToLong(byte[] bytes, int start) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    private static final int LONG_BYTES = Long.SIZE / 8;
    private static final ByteBuffer LONG_BUFFER = ByteBuffer
            .allocate(LONG_BYTES);//from   w  ww .j a v  a  2  s. c o  m

    public static long bytesToLong(byte[] bytes, int start) {
        LONG_BUFFER.position(0);
        LONG_BUFFER.put(bytes, start, LONG_BYTES);
        LONG_BUFFER.flip();
        return LONG_BUFFER.getLong(0);
    }
}

Related

  1. byteToLong(byte[] b)
  2. bytesLE2long(byte[] b, int off)
  3. bytesLE2longs(byte[] b)
  4. bytesToLong(byte[] bytes)
  5. bytesToLong(byte[] bytes)
  6. bytes2ulong(byte[] bytes, int from, int to)
  7. getLong(byte[] bb, int index)
  8. getLong(byte[] bb, int index)
  9. getLong(byte[] buf, boolean bigEndian)