Java Byte Array to Long bytesToLong(byte[] a, int ao)

Here you can find the source of bytesToLong(byte[] a, int ao)

Description

bytes To Long

License

Open Source License

Declaration

public static final long bytesToLong(byte[] a, int ao) 

Method Source Code

//package com.java2s;
/**//  w w w.  j a  v  a  2s.  co  m
  *         Commmon Internet File System Java API (JCIFS)
  *----------------------------------------------------------------
  *  Copyright (C) 1999  Norbert Hranitzky
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License as
  *  published by the Free Software Foundation; either version 2 of
  *  the License, or (at your option) any later version.
  *
  *  This program 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
  *  General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  *  The full copyright text: http://www.gnu.org/copyleft/gpl.html
  *
  *----------------------------------------------------------------
  *  Author: Norbert Hranitzky
  *  Email : norbert.hranitzky@mchp.siemens.de
  *  Web   : http://www.hranitzky.purespace.de
  */

public class Main {
    public static final long bytesToLong(byte[] a, int ao) {
        return ((a[ao] & 0xffL) << 56) | ((a[ao + 1] & 0xffL) << 48) | ((a[ao + 2] & 0xffL) << 40)
                | ((a[ao + 3] & 0xffL) << 32) | ((a[ao + 4] & 0xffL) << 24) | ((a[ao + 5] & 0xffL) << 16)
                | ((a[ao + 6] & 0xffL) << 8) | (a[ao + 7] & 0xffL);
    }
}

Related

  1. bytes2Long(byte[] bytes, int offset)
  2. bytes2Long(final byte[] b)
  3. bytes2long(final byte[] bytes, final int start)
  4. bytesToLong(byte a, byte b, byte c, byte d)
  5. bytesToLong(byte a, byte b, byte c, byte d, byte e, byte f, byte g, byte h, boolean swapBytes)
  6. bytesToLong(byte[] arr, int offset)
  7. bytesToLong(byte[] array, int offset)
  8. bytesToLong(byte[] b)
  9. bytesToLong(byte[] b)