public int encodeDigits(ByteArrayOutputStream bos) {
        boolean isOdd = this.oddFlag == _FLAG_ODD;

        byte b = 0;
        int count = (!isOdd) ? address.length() : address.length() - 1;
        int bytesCount = 0;
        for (int i = 0; i < count - 1; i += 2) {
            String ds1 = address.substring(i, i + 1);
            String ds2 = address.substring(i + 1, i + 2);

            int d1 = Integer.parseInt(ds1, 16);
            int d2 = Integer.parseInt(ds2, 16);

            b = (byte) (d2 << 4 | d1);
            bos.write(b);
            bytesCount++;
        }

        if (isOdd) {
            String ds1 = address.substring(count, count + 1);
            int d = Integer.parseInt(ds1);

            b = (byte) (d & 0x0f);
            bos.write(b);
            bytesCount++;
        }

        return bytesCount;
    }
public int encodeDigits ( ByteArrayOutputStream bos ) { boolean isOdd = this . oddFlag == _FLAG_ODD ; byte b = 0 ; int count = ( ! isOdd ) ? address . length ( ) : address . length ( ) - 1 ; int bytesCount = 0 ; for ( int i = 0 ; i < count - 1 ; i += 2 ) { String ds1 = address . substring ( i , i + 1 ) ; String ds2 = address . substring ( i + 1 , i + 2 ) ; int d1 = Integer . parseInt ( ds1 , 16 ) ; int d2 = Integer . parseInt ( ds2 , 16 ) ; b = ( byte ) ( d2 << 4 | d1 ) ; bos . write ( b ) ; bytesCount ++ ; } if ( isOdd ) { String ds1 = address . substring ( count , count + 1 ) ; int d = Integer . parseInt ( ds1 ) ; b = ( byte ) ( d & 0x0f ) ; bos . write ( b ) ; bytesCount ++ ; } return bytesCount ; }
This method is used in encode. Encodes digits part. This is because

@param bos - where digits will be encoded
@return - number of bytes encoded