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

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