int result = 0; for (int i=0; i<4; i++) { result = ( result << 8 ) - Byte.MIN_VALUE + (int) bytes[i]; } return result;