Java Long Number From toLongBE(byte[] src, int offset)

Here you can find the source of toLongBE(byte[] src, int offset)

Description

64bit to long

License

Open Source License

Declaration

public static final long toLongBE(byte[] src, int offset) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Jens Kristian Villadsen.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html/* w w  w.  ja va  2  s . c  o  m*/
 * 
 * Contributors:
 *     Jens Kristian Villadsen - Lead developer, owner and creator
 ******************************************************************************/

public class Main {
    /**
     * 64bit to long
     */
    public static final long toLongBE(byte[] src, int offset) {
        return (((src[offset] & 0xFFl) << 56l) + ((src[++offset] & 0xFFl) << 48l) + ((src[++offset] & 0xFFl) << 40l)
                + ((src[++offset] & 0xFFl) << 32l) + ((src[++offset] & 0xFFl) << 24l)
                + ((src[++offset] & 0xFFl) << 16l) + ((src[++offset] & 0xFFl) << 8l) + (src[++offset] & 0xFFl));
    }
}

Related

  1. longFromDB(String dbLong)
  2. longFromLex(byte[] bytes)
  3. longFromObject(Object o)
  4. toLongAsObject(Object obj)
  5. toLongBE(byte[] b, int i)
  6. toLongDate()
  7. toLongDefaultIfNull(Long configured, long theDefault)
  8. toLongExactWithoutOverflow(float value)
  9. toLongId(Integer i)