cdm/src/main/java/ucar/unidata/io/Swap.java
static public int swapInt(byte[] b, int offset) {
        // 4 bytes
        int accum = 0;
        for (int shiftBy = 0, i = offset; shiftBy < 32; shiftBy += 8, i++) {
            accum |= (b[i] & 0xff) << shiftBy;
        }
        return accum;
    }
static public int swapInt(byte[] b, int offset) {
        // 4 bytes
        int accum = 0;
        for (int shiftBy = 0, i = offset; shiftBy < 32; shiftBy += 8, i++) {
            accum |= (b[i] & 0xff) << shiftBy;
        }
        return accum;
    }
Returns the int resulting from reversing 4 bytes at a specified
offset in a byte array.

@param  b       the byte array
@param  offset  the offset of the first byte
@return         the int represented by the bytes
<code>b[offset+3], b[offset+2], ..., b[offset]</code>