Android Big Endian Convert toBigEndianIntFromTwoBytes(byte[] b, int pos)

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

Description

to Big Endian Int From Two Bytes

Declaration

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

Method Source Code

//package com.java2s;

public class Main {

    public static int toBigEndianIntFromTwoBytes(byte[] b, int pos) {
        int ret = 0;
        ret |= (b[pos + 1] & 0xFF);//from   w w w . j a  v a 2s . co m
        ret |= (b[pos] & 0xFF) << 8;

        return (int) ret;
    }
}

Related

  1. toBigEndianByteArray(long val, byte[] b, int pos)
  2. toBigEndianByteArray(short val, byte[] b, int pos)
  3. toBigEndianBytes(int x)
  4. toBigEndianBytes(long x)
  5. toBigEndianBytes(short x)
  6. toBigEndianInteger(byte[] b, int pos)
  7. toBigEndianInteger(byte[] b, int pos, int width)
  8. toBigEndianLong(byte[] b, int pos, int width)
  9. toBigEndianShort(byte[] b, int pos)