Android Byte Array to Long Convert toLong(byte[] in)

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

Description

to Long

License

LGPL

Declaration

public static long toLong(byte[] in) 

Method Source Code

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

public class Main {
    public static long toLong(byte[] in) {
        long out = 0;
        for (int i = in.length - 1; i > 0; i--) {
            out |= in[i] & 0xff;//from   w  w w .j  a  v a  2s  .  c o m
            out <<= 8;
        }
        out |= in[0] & 0xff;
        return out;
    }
}

Related

  1. swap64bitFromArray(byte[] value, int offset)
  2. parseLong(byte[] b, int start, int end, int radix)
  3. parseLong(byte[] b, int start, int end)
  4. bytes2long(byte[] b)
  5. byteArrayToLong(byte[] arr)