Here you can find the source of byte2int(int[] output, byte[] input, int ioff, int len)
final static void byte2int(int[] output, byte[] input, int ioff, int len)
//package com.java2s; public class Main { /**//w w w . j ava 2 s . c om * Byte2ints input (bytes) into output (int). * Assumes len is a multiple of 4. */ final static void byte2int(int[] output, byte[] input, int ioff, int len) { int i = 0; for (int j = ioff; j < (ioff + len); j += 4) { // This code doesn't work. // Well yes it does, *NOW* as I mask each byte with 0xff. // Took me the longest time to figure this out. output[i] = (input[j + 0] & 0xff) | ((input[j + 1] & 0xff) << 8) | ((input[j + 2] & 0xff) << 16) | ((input[j + 3] & 0xff) << 24); i++; } } }