Java Convert via ByteBuffer toLong(byte data[])

Here you can find the source of toLong(byte data[])

Description

to Long

License

Apache License

Declaration

public static long toLong(byte data[]) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {

    public static long toLong(byte data[]) {
        ByteBuffer buffer = ByteBuffer.allocate(8);
        buffer.put(data, 0, data.length > 8 ? 8 : data.length);
        buffer.flip();/*  w  w  w .  jav a2 s .  c o  m*/
        return buffer.getLong();
    }
}

Related

  1. toIntArray(float[] floatArray)
  2. toIntBuffer(int[] array)
  3. toIntFromByteArray(byte[] byteArray)
  4. toLittleEndian(int value)
  5. toLMBCS(final String value)
  6. toLong(byte[] array)
  7. toLong(byte[] bytes)
  8. toLongArray(byte[] b)
  9. ToLongArray(byte[] data)