Java Byte Array to Long bytesToLong(byte[] data)

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

Description

bytes To Long

License

Open Source License

Declaration

public static Long bytesToLong(byte[] data) 

Method Source Code

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

public class Main {
    public static Long bytesToLong(byte[] data) {
        if (data.length > 8)
            throw new RuntimeException("array too long to convert to long");
        long result = 0;
        for (byte x : data)
            result = (result << 8) | (x & 0xff);
        return result;
    }// ww w . ja va  2s .c om
}

Related

  1. bytesToLong(byte[] bytes, int index)
  2. bytesToLong(byte[] bytes, int off)
  3. bytesToLong(byte[] bytes, int off, boolean bigEndian)
  4. bytesToLong(byte[] data)
  5. bytesToLong(byte[] data)
  6. bytesToLong(byte[] data, int offset)
  7. bytesToLong(byte[] inbytes, int shift)
  8. bytesToLong(byte[] longBytes)
  9. bytesToLong(byte[] p, int offset)