public static int bigEndianToInt(byte[] bs, int off) {
        int n = bs[off] << 24;
        n |= (bs[++off] & 0xff) << 16;
        n |= (bs[++off] & 0xff) << 8;
        n |= (bs[++off] & 0xff);
        return n;
    }
Utility methods for converting byte arrays into ints and longs, and back again.
turms-server-common/src/main/java/org/bouncycastle/util/Pack.java