public static int byteArrayToInt(byte[] bytes, int offset, int length) {
    if ((length > 4) || (length < 0)) {
      throw new IllegalArgumentException("length must be between 0 and 4");
    }
    if (offset < 0 || offset + length > bytes.length) {
      throw new IllegalArgumentException("offset and length are out of bounds");
    }
    int value = 0;
    for (int i = 0; i < length; i++) {
      value += (bytes[i + offset] & 0xFF) << (i * 8);
    }
    return value;
  }
Transforms a passed LSB first byte array to an int

@param bytes that should be transformed to a byte array
@param offset start index to start the transformation
@param length amount of the passed {@code bytes} that should be transformed
java_src/src/main/java/com/google/crypto/tink/subtle/Bytes.java