Android Byte Array to Int Convert toInt(byte[] src)

Here you can find the source of toInt(byte[] src)

Description

to Int

Declaration

public static int toInt(byte[] src) 

Method Source Code

//package com.java2s;

public class Main {

    public static int toInt(byte[] src, int srcPos) {
        int dword = 0;
        for (int i = 0; i < 4; i++) {
            dword = (dword << 8) + (src[i + srcPos] & 0xFF);
        }//from   ww  w  .j  ava 2s  .c o m
        return dword;
    }

    public static int toInt(byte[] src) {
        return toInt(src, 0);
    }
}

Related

  1. getInts(int[] toInts, byte[] fromBytes)
  2. getInts(int[] toInts, byte[] fromBytes, int fromOffset)
  3. getUIntByByte(byte data)
  4. getUIntByByteArray(byte[] data)
  5. getUIntByByteArray(byte[] data, boolean isLH)
  6. toInt(byte[] src, int srcPos)
  7. toIntFromTwoBytes(byte[] b, int pos)
  8. toInteger(byte[] b, int pos)
  9. toInteger(byte[] b, int pos, int width)