Here you can find the source of toIntegerArray(byte[] input, int offset, int len)
public static int[] toIntegerArray(byte[] input, int offset, int len)
//package com.java2s; //License from project: Apache License public class Main { public static int[] toIntegerArray(byte[] input, int offset, int len) { assert len % 4 == 0 : "Must be a multiple of 4 bytes"; int[] result = new int[len / 4]; toIntegerArray(input, offset, len, result, 0); return result; }/* w w w . ja v a 2 s . co m*/ public static void toIntegerArray(byte[] input, int offset, int len, int[] output, int outputOffset) { assert len % 4 == 0 : "Must be a multiple of 4 bytes"; int outputLen = len / 4; assert offset + outputLen < output.length : "Output buffer too short"; for (int i = outputOffset; i < outputOffset + outputLen; i++) { output[i] = toInteger(input, offset); offset += 4; } } public static int toInteger(byte[] input) { return toInteger(input, 0); } private static int toInteger(byte[] input, int offset) { assert offset + 4 <= input.length : "Invalid length " + input.length; return ((input[offset++] & 0xff) << 24) | ((input[offset++] & 0xff) << 16) | ((input[offset++] & 0xff) << 8) | ((input[offset++] & 0xff)); } }