public static int convertByteArrayToInt(byte[] numberAsByteArray) {

    long tempResult = ParseFilter.convertByteArrayToLong(numberAsByteArray);

    if (tempResult > Integer.MAX_VALUE) {
      throw new IllegalArgumentException("Integer Argument too large");
    } else if (tempResult < Integer.MIN_VALUE) {
      throw new IllegalArgumentException("Integer Argument too small");
    }

    int result = (int) tempResult;
    return result;
  }
Converts an int expressed in a byte array to an actual int
<p>
This doesn't use Bytes.toInt because that assumes that there will be {@link Bytes#SIZEOF_INT}
bytes available.
<p>
@param numberAsByteArray the int value expressed as a byte array
@return the int value
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java