else if ( received[ j ] instanceof String ) msglength = msglength + content[ i ].toString().length() + 2;
else if ( received[ j ] instanceof String ) msglength = msglength + received[ j ].toString().length() + 2;
	private static byte[] createContent( Object[] content ) {		int msglength = 0;		short listcount = 0;		//First of All, we calculate the length (msglength) of the PayLoad: 		for ( int i = 0; i < content.length; i++ ) {			if ( content[ i ] instanceof Byte )				msglength++;			else if ( content[ i ] instanceof Short )				msglength += 2;			else if ( content[ i ] instanceof Integer )				msglength += 4;			else if ( content[ i ] instanceof Long )				msglength += 8;			else if ( content[ i ] instanceof String )				msglength = msglength + content[ i ].toString().length() + 2;			else if ( content[ i ].getClass().isArray() ) {				if ( listcount == 0 )	msglength += 2;				//On first array-entry add 2 bytes for List-header				listcount++;				Object[] received;				//getting the length of listentrys								if ( content[ i ] instanceof Object[] ) {					received = ( Object[] ) content[ i ];					for ( int j = 0; j < received.length; j++ ) {						if ( received[ j ] instanceof Byte )							msglength++;						else if ( received[ j ] instanceof Short )							msglength += 2;						else if ( received[ j ] instanceof Integer )							msglength += 4;						else if ( received[ j ] instanceof Long )							msglength += 8;						else if ( received[ j ] instanceof String )							msglength =								msglength + content[ i ].toString().length() + 2;					} //end for loop				} // end if			} // end last else if 		} // end for loop		//Then we re-run the whole Thing again, creating the result:		byte[] buffer;		buffer = new byte[ msglength ];		int buffer_walker = 0;		boolean list_head_written = false;		for ( int i = 0; i < content.length; i++ ) {			if ( content[ i ] instanceof Byte ) {				byte temp = ( ( Byte ) content[ i ] ).byteValue();				buffer[ buffer_walker++ ] = temp;			}			if ( content[ i ] instanceof Short ) {				//converting Object to short (is there some nicer way?)								byte[] helper = Message.toBytes( ( ( Short ) content[ i ] ).shortValue() );				System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );				buffer_walker += helper.length;			} 			else if ( content[ i ] instanceof Integer ) {				//converting Object to Int (is there some nicer way?)								byte[] helper = Message.toBytes( ( ( Integer ) content[ i ] ).intValue() );				System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );				buffer_walker += helper.length;			}			else if ( content[ i ] instanceof Long ) {				//converting Object to Int (is there some nicer way?)								byte[] helper = Message.toBytes( ( ( Long ) content[ i ] ).longValue() );				System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );				buffer_walker += helper.length;			}			else if ( content[ i ] instanceof String ) {				String temp = content[ i ].toString();				byte[] prefix = Message.toBytes( ( short ) temp.length() );				buffer[ buffer_walker++ ] = prefix[ 0 ];				buffer[ buffer_walker++ ] = prefix[ 1 ];				byte[] helper = temp.getBytes();				System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );				buffer_walker += helper.length;			}			else if ( content[ i ].getClass().isArray() ) {				Object[] received;				/*				 * Hey, we've got a list, let's get to work				 * First of all, we type in List-header (number of _ROWS_ in the List)				 */				if ( !list_head_written ) {					byte[] temp = Message.toBytes( listcount );					System.arraycopy( temp, 0, buffer, buffer_walker, temp.length );					buffer_walker += temp.length;					list_head_written = true;				}				/*				 * Now we add the current _ROW_ to the Buffer				 */				if ( content[i] instanceof Object[] ) {					received = ( Object[] ) content[ i ];					for ( int j = 0; j < received.length; j++ ) {						if ( received[ j ] instanceof Byte ) {							buffer[ buffer_walker++ ] = ( ( Byte ) received[ j ] ).byteValue();						}						else if ( received[ j ] instanceof Short ) {							byte[] helper = Message.toBytes( ((Short)received[j]).shortValue() );							System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );							buffer_walker += helper.length;						}						else if ( received[ j ] instanceof Integer ) {							byte[] helper = Message.toBytes( ((Integer)received[j]).intValue() );							System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );							buffer_walker += helper.length;						}						else if ( received[ j ] instanceof Long ) {							byte[] helper = Message.toBytes( ((Long)received[j]).longValue() );							System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );							buffer_walker += helper.length;						}						else if ( received[ j ] instanceof String ) {							String temp = received[ j ].toString();							byte[] prefix = Message.toBytes( ( short ) temp.length() );							buffer[ buffer_walker++ ] = prefix[ 0 ];							buffer[ buffer_walker++ ] = prefix[ 1 ];							byte[] helper = temp.getBytes();							System.arraycopy( helper, 0, buffer, buffer_walker, helper.length );							buffer_walker += helper.length;						}					}//End of processing Single List-Entry 				}//End of processing Array_ROW_			} //End of processing array		} //End of creating the result		return buffer;	}