Java Byte Array Convert To bytes2intLE(byte[] bytes, int offset, int len)

Here you can find the source of bytes2intLE(byte[] bytes, int offset, int len)

Description

bytesint LE

License

Open Source License

Parameter

Parameter Description
bytes a parameter
offset a parameter
len a parameter

Return

bytes2intLE

Declaration

public static int bytes2intLE(byte[] bytes, int offset, int len) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2015 Orange.//from   w  ww .  j a  v  a2 s.  co  m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Victor PERRON, Antonin CHAZALET, Andre BOTTARO.
 *******************************************************************************/

public class Main {
    /**
     * @param bytes
     * @param offset
     * @param len
     * @return bytes2intLE
     */
    public static int bytes2intLE(byte[] bytes, int offset, int len) {
        int sum = 0;
        for (int i = 0; i < len; i++) {
            byte b = bytes[offset + len - i - 1];
            sum = sum + ((b & 0xff) << (i * 8));
        }
        return sum;
    }
}

Related

  1. bytes2Bin(byte[] bytes)
  2. bytes2boolean(final byte[] b)
  3. bytes2byteArray(byte[] bytes, byte separator)
  4. bytes2Chars(byte[] bytes)
  5. bytes2humanReadable(long bytes)
  6. bytes2ip(byte[] bytes)
  7. bytes2IPV4(byte[] addr, int offset)
  8. bytes2nibbles(byte[] bytes)
  9. bytes2unique(byte[] daten, int offset)