Android Byte Array to Int Convert bytes2uint(byte[] bytes, int from, int to)

Here you can find the source of bytes2uint(byte[] bytes, int from, int to)

Description

bytesuint

Declaration

public static int bytes2uint(byte[] bytes, int from, int to) 

Method Source Code

//package com.java2s;

public class Main {
    public static int bytes2uint(byte[] bytes, int from, int to) {
        int result = 0;

        int len = to - from;

        for (int i = from; i < to; i++) {
            int shiftValue = (to - i - 1) * 8;

            result += (bytes[i] << shiftValue)
                    & (0x0000FFFF >>> ((len - 1) * 8 - shiftValue));
        }/*  w  ww  .  ja  v a2  s  .  c o m*/

        return result;
    }
}

Related

  1. bytesToInt(byte[] bytes)
  2. bytesToInt(byte[] in)
  3. bytesLE2int(byte[] b, int off)
  4. bytesLE2ints(byte[] b)
  5. byteToUint(byte b)
  6. bytesBE2int(byte[] b, int off)
  7. bytesBE2ints(byte[] b)
  8. getInt(byte b)
  9. getInt(byte[] bb, int index)