public static byte[] toByteArray(SmsUdhElement[] udhElements){
  ByteArrayOutputStream baos=new ByteArrayOutputStream(100);
  if (udhElements == null) {
    return new byte[0];
  }
  baos.write((byte)SmsUdhUtil.getTotalSize(udhElements));
  try {
    for (    SmsUdhElement udhElement : udhElements) {
      udhElement.writeTo(baos);
    }
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
  return baos.toByteArray();
}

public static byte [ ] toByteArray ( SmsUdhElement [ ] udhElements ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( 100 ) ; if ( udhElements == null ) { return new byte [ 0 ] ; } baos . write ( ( byte ) SmsUdhUtil . getTotalSize ( udhElements ) ) ; try { for ( SmsUdhElement udhElement : udhElements ) { udhElement . writeTo ( baos ) ; } } catch ( IOException ioe ) { throw new RuntimeException ( ioe ) ; } return baos . toByteArray ( ) ; }
returns the whole udh as a byte array . < p > the returned udh is the same as specified when the message was created . no concat headers are added . todo : rename this function . the name is totally wrong .
