public static Mode compressionMode(int min, int max) {
        if (min >= 0 && max < 1 << 30) return Mode.COMPRESSED_POSITIVE;
        if (min > -1 << 29 && max < 1 << 29) return Mode.COMPRESSED;
        return Mode.NONE;
    }
Utility for bytewise compressing of integers into a ByteBuffer.

@author baldersheim
vespajlib/src/main/java/com/yahoo/compress/IntegerCompressor.java