Android Byte Array to Int Convert getIntFrom2ByteArray(final byte[] input)

Here you can find the source of getIntFrom2ByteArray(final byte[] input)

Description

get Int From Byte Array

Declaration

public static int getIntFrom2ByteArray(final byte[] input) 

Method Source Code

//package com.java2s;
import java.nio.ByteBuffer;

public class Main {
    public static int getIntFrom2ByteArray(final byte[] input) {
        final byte[] result = new byte[4];

        result[0] = 0;//from  ww w .j ava2s . c  o  m
        result[1] = 0;
        result[2] = input[0];
        result[3] = input[1];

        return getIntFromByteArray(result);
    }

    public static int getIntFromByteArray(final byte[] byteArr) {
        return ByteBuffer.wrap(byteArr).getInt();
    }
}

Related

  1. getInt(byte[] buffer, int pos, int count)
  2. getInt(byte[] bytes)
  3. getInt(int offset, byte[] fromBytes)
  4. getInt2(byte[] b, int offset)
  5. getInt3(byte[] b, int offset)
  6. getIntFromByte(final byte bite)
  7. getIntFromByte(final byte bite)
  8. getIntFromByteArray(final byte[] byteArr)
  9. getIntFromByteArray(final byte[] bytes)