Java Long Number From longFromBytes(byte b8, byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1)

Here you can find the source of longFromBytes(byte b8, byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1)

Description

long From Bytes

License

Open Source License

Declaration

public static long longFromBytes(byte b8, byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1) 

Method Source Code

//package com.java2s;
/*/*w w w .  jav  a2 s  .  co  m*/
This file is part of Socks via HTTP.
    
This package 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.
    
Socks via HTTP 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 Socks via HTTP; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

public class Main {
    public static long longFromBytes(byte b8, byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1) {
        long l = 0;
        l += (((long) b1) & 0xFF);
        l += (((long) b2) & 0xFF) << 8;
        l += (((long) b3) & 0xFF) << 16;
        l += (((long) b4) & 0xFF) << 24;
        l += (((long) b5) & 0xFF) << 32;
        l += (((long) b6) & 0xFF) << 40;
        l += (((long) b7) & 0xFF) << 48;
        l += (((long) b8) & 0xFF) << 56;
        return (l);
    }
}

Related

  1. longFromBase64(String value)
  2. longFromBigEndainArray(byte[] buf, int offset, int len)
  3. longFromByteArray(byte[] bytes)
  4. longFromByteArray(final byte[] buf, final int offset)
  5. longFrombytes(byte[] b, int pos)
  6. longFromBytes(byte[] buffer, int offset)
  7. longFromBytes(byte[] bytes, int index)
  8. longFromBytes(byte[] bytes, int offset)