Convert two element byte array to int - Android java.lang

Android examples for java.lang:Integer

Description

Convert two element byte array to int

Demo Code

public class Main{

    private static int getShort(byte[] data) {
        return (int) ((data[0] << 8) | data[1] & 0xFF);
    }/* w w  w  .j  ava  2s .c  om*/

}

Related Tutorials