Android Byte Array to Int Convert toIntFromTwoBytes(byte[] b, int pos)

Here you can find the source of toIntFromTwoBytes(byte[] b, int pos)

Description

to Int From Two Bytes

Declaration

public static int toIntFromTwoBytes(byte[] b, int pos) 

Method Source Code

//package com.java2s;

public class Main {

    public static int toIntFromTwoBytes(byte[] b, int pos) {
        int ret = 0;
        ret |= (b[pos] & 0xFF);/*from w w w. j  ava  2 s.c om*/
        ret |= (b[pos + 1] & 0xFF) << 8;

        return (int) ret;
    }
}

Related

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