public static int getSerializedSize1_4Bytes(int number) {
        if (number < 0) {
            throw new IllegalArgumentException("Cannot encode negative number");
        }
        //no need to check upper boundary, since INT_MAX == 2^31

        if (number < 0x80) {
            //length 1 byte
            return 1;
        } else {
            //length 4 bytes
            return 4;
        }
    }
Computes the size used for storing the given integer using 1 or 4 bytes.

@param number the integer to check length of
@return the number of bytes used to store it; 1 or 4
vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java