System.out.println(msg.length());
    public byte[] buildSubmit(byte dcs, SmsPdu pdu, boolean moreToSend, SmsAddress sender, SmsAddress dest)        throws SmsException    {        String ud;        byte udhData[];        UcpUtil util = new UcpUtil();        UcpSeries50 ucpSubmit = new UcpSeries50(UcpSeries50.OP_SUBMIT_SHORT_MESSAGE);        byte[] udh = pdu.getUserDataHeaders();        boolean isSeptets = (SmsDcsUtil.getAlphabet(dcs) == SmsConstants.ALPHABET_GSM);        int udBits;        // FIXME: TRN        ucpSubmit.setTRN(0x01);        // OTOA = Originator Type Of Address (1139 = OadC is set to NPI        // telephone and TON international, 5039 The OAdC contains an        // alphanumeric address)        // OAdC = Address code originator        if (sender.getTypeOfNumber() == SmsConstants.TON_ALPHANUMERIC)        {            String addr = sender.getAddress();            		if (addr.length() > 11) throw new SmsException("Max alphanumeric Originator Address Code length exceded (11)");			// Changed by LB. The Alphanumeric Sender was not set correctly			String codedaddr = util.encode7bitsIn8(addr);			int x = codedaddr.length();			StringBuffer sb = new StringBuffer("00");			sb.replace(2 - Integer.toHexString(x).toUpperCase().length(), 2,	       	Integer.toHexString(x).toUpperCase());                        ucpSubmit.setField(UcpSeries50.FIELD_OAdC, sb.toString().concat(codedaddr));            ucpSubmit.setField(UcpSeries50.FIELD_OTOA, "5039");                    }        else        {            ucpSubmit.setField(UcpSeries50.FIELD_OTOA, "1139");            ucpSubmit.setField(UcpSeries50.FIELD_OAdC, sender.getAddress());        }        // AdC = Address code recipient for the SM        ucpSubmit.setField(UcpSeries50.FIELD_AdC, dest.getAddress());		if (pdu.getUserDataHeaders() == null)  // Handel Messages without UDH		{			switch (SmsDcsUtil.getAlphabet(dcs))			{				case SmsConstants.ALPHABET_GSM:					System.out.println("GSM Message without UDH");					ucpSubmit.setField(UcpSeries50.FIELD_MT, "3");					String msg = SmsPduUtil.readSeptets(pdu.getUserData(), pdu.getUserDataLength());					ucpSubmit.setField(UcpSeries50.FIELD_Msg,util.encodeInIRA(msg));					break;				case SmsConstants.ALPHABET_8BIT:					throw new SmsException(" 8Bit Messages without UDH are not Supported");				case SmsConstants.ALPHABET_UCS2:					System.out.println("UCS2 Message without UDH");					ud = StringUtil.bytesToHexString(pdu.getUserData());					ucpSubmit.setField(UcpSeries50.FIELD_Msg,ud);					//Numer of of bits in Transperent Data Message					udBits = pdu.getUserDataLength() * ((isSeptets) ? 7 : 8);					ucpSubmit.setField(UcpSeries50.FIELD_NB,StringUtil.intToString(udBits, 4));					// Set message Type fix to 4 					ucpSubmit.setField(UcpSeries50.FIELD_MT,"4");					ucpSubmit.clearXSer();			        ucpSubmit.addXSer(UcpSeries50.XSER_TYPE_DCS, dcs);					break;            	default:                	throw new SmsException("Unsupported data coding scheme");			}		}else {			switch (SmsDcsUtil.getAlphabet(dcs))			{				case SmsConstants.ALPHABET_GSM:	                throw new SmsException("Cannot send 7 bit encoded messages with UDH");				case SmsConstants.ALPHABET_8BIT:					ud = StringUtil.bytesToHexString(pdu.getUserData());	                udhData = pdu.getUserDataHeaders();	                // Add length of udh	                String udh_str = StringUtil.bytesToHexString(new byte[] {(byte) (udhData.length )});	                udh_str += StringUtil.bytesToHexString(udhData);					ucpSubmit.setField(UcpSeries50.FIELD_Msg,ud);					//Numer of of bits in Transperent Data Message					udBits = pdu.getUserDataLength() * ((isSeptets) ? 7 : 8);//					udBits = pdu.getUserDataLength();					ucpSubmit.setField(UcpSeries50.FIELD_NB,StringUtil.intToString(udBits, 4));					// Set message Type fix to 4 					ucpSubmit.setField(UcpSeries50.FIELD_MT,"4");					// Store the UDH			        ucpSubmit.clearXSer();			        ucpSubmit.addXSer(UcpSeries50.XSER_TYPE_DCS, dcs);			        ucpSubmit.addXSer(UcpSeries50.XSER_TYPE_UDH, udhData);					break;				case SmsConstants.ALPHABET_UCS2:					throw new SmsException(" UCS2 Messages are currently not Supportet ");//					break;            	default:                	throw new SmsException("Unsupported data coding scheme");			}		}	        // XSer = Extra Services//	        ucpSubmit.clearXSer();//	        ucpSubmit.addXSer(UcpSeries50.XSER_TYPE_DCS, dcs);//	        if (udh != null)//			//	        // NB = Number of bits in TMsg//	        udBits = pdu.getUserDataLength() * ((isSeptets) ? 7 : 8);//	        udBits = pdu.getUserDataLength();//	        ucpSubmit.setField(UcpSeries50.FIELD_NB, StringUtil.intToString(udBits, 4));//	       	ucpSubmit.setField(UcpSeries50.FIELD_Msg, StringUtil.bytesToHexString(pdu.getUserData()));//        / MMS = More messages to send        if (moreToSend)        {            ucpSubmit.setField(UcpSeries50.FIELD_MMS, "1");        }        return ucpSubmit.getCommand();    }