Here you can find the source of toInt32(int[] data, int startIndex)
Parameter | Description |
---|---|
data | a parameter |
startIndex | a parameter |
public static int toInt32(int[] data, int startIndex)
//package com.java2s; //License from project: Apache License public class Main { /**/* w w w .j ava2 s . com*/ * Extract a signed 32-bit number from an array of int data * @param data * @param startIndex * @return */ public static int toInt32(int[] data, int startIndex) { int dataLength = 4; int length = data.length; if (startIndex < 0 || (startIndex + dataLength) > length) { throw new IndexOutOfBoundsException("Index: " + startIndex + ", Length: " + length); } int value = 0; for (int i = 0; i < dataLength; i++) { value = (value << 8) + data[startIndex + i]; } return value; } }