Here you can find the source of unsignedShortToInt(final byte[] b)
Parameter | Description |
---|---|
b | a byte array of length 2 |
public static final int unsignedShortToInt(final byte[] b)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . j a v a 2 s . c o m * Converts a two byte array to an integer * * @param b a byte array of length 2 * @return an int representing the unsigned short */ public static final int unsignedShortToInt(final byte[] b) { int i = 0; i |= b[0] & 0xFF; i <<= 8; i |= b[1] & 0xFF; return i; } }