Android Byte Array to Int Convert getInt(byte[] bytes)

Here you can find the source of getInt(byte[] bytes)

Description

get Int

License

Open Source License

Declaration

public static int getInt(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    public static int getInt(byte[] bytes) {
        return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8))
                | (0xff0000 & (bytes[2] << 16))
                | (0xff000000 & (bytes[3] << 24));
    }/*from w w  w .  j av a2  s. c  o  m*/

    public static int getInt(byte b) {
        return (0xff & b);
    }
}

Related

  1. getInt(byte[] bb, int index)
  2. getInt(byte[] bb, int index)
  3. getInt(byte[] buf, boolean bigEndian)
  4. getInt(byte[] buf, int pos, boolean bigEndian)
  5. getInt(byte[] buffer, int pos, int count)
  6. getInt(int offset, byte[] fromBytes)
  7. getInt2(byte[] b, int offset)
  8. getInt3(byte[] b, int offset)
  9. getIntFrom2ByteArray(final byte[] input)