public static int encode(Integer value, byte[] dst, int dstOffset) {
        if (value == null) {
            dst[dstOffset] = NULL_BYTE_HIGH;
            return 1;
        } else {
            dst[dstOffset] = NOT_NULL_BYTE_HIGH;
            encode(value.intValue(), dst, dstOffset + 1);
            return 5;
        }
    }
public static int encode ( Integer value , byte [ ] dst , int dstOffset ) { if ( value == null ) { dst [ dstOffset ] = NULL_BYTE_HIGH ; return 1 ; } else { dst [ dstOffset ] = NOT_NULL_BYTE_HIGH ; encode ( value . intValue ( ) , dst , dstOffset + 1 ) ; return 5 ; } }
Encodes the given signed Integer object into exactly 1 or 5 bytes. If
the Integer object is never expected to be null, consider encoding as an
int primitive.

@param value optional signed Integer value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array
@return amount of bytes written