Index: /branches/network/src/lib/network/Makefile.am
===================================================================
--- /branches/network/src/lib/network/Makefile.am	(revision 6105)
+++ /branches/network/src/lib/network/Makefile.am	(revision 6106)
@@ -13,5 +13,6 @@
 		      server_socket.cc \
 		      handshake.cc \
-		      entity_manager.cc
+		      entity_manager.cc \
+		      converter.cc
 
 
@@ -27,5 +28,6 @@
 		 server_socket.h \
 		 handshake.h \
-		 entity_manager.h
+		 entity_manager.h \
+		 converter.h
 
 
Index: /branches/network/src/lib/network/converter.cc
===================================================================
--- /branches/network/src/lib/network/converter.cc	(revision 6106)
+++ /branches/network/src/lib/network/converter.cc	(revision 6106)
@@ -0,0 +1,106 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Wuest
+   co-programmer: ...
+*/
+
+
+/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
+   For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
+*/
+#define DEBUG_MODULE_NETWORK
+
+/* include your own header */
+#include "converter.h"
+
+
+/* using namespace std is default, this needs to be here */
+using namespace std;
+
+/*!
+ * Standard constructor
+ */
+Converter::Converter()
+{
+  /* set the class id for the base object */
+  //this->setClassID(CL_ENTITY_MANAGER, "EntityManager");
+}
+
+/*!
+ * Standard destructor
+ */
+Converter::~Converter()
+{
+}
+
+const int sgnadd = 128; // = 2^7
+
+/*!
+ * Converts an int into a byte-array
+ * @remarks: The int is stored in big-endian
+ * @param x: The int which is to convert
+ * @return: A byte-array that accords the given int value
+ */
+byte* Converter::intToByteArray(int x)
+{
+  const int mod = 256; // = 2^8
+  
+  
+  byte* result = new byte[INTSIZE];
+  int sgn;
+  if (x >= 0)
+    sgn = 1;
+  else
+  {
+    sgn = -1;
+    x = -x;
+  }
+  
+  for (int i = 0; i < INTSIZE; i++)
+  {
+    result[i] = x % mod;
+    x /= mod;
+  }
+  
+  if (sgn == -1)
+    result[INTSIZE - 1] += sgnadd;
+  
+  
+  return result;
+}
+
+/*!
+ * Converts a byte-array into an int
+ * @param a: The byte-array which is to convert
+ * @return: An int that accords the given byte-array
+ */
+int Converter::byteArrayToInt(byte* a)
+{
+  int mult = 1;
+  const int step = 256; // = 2 ^ 8
+  int result = 0;
+  for (int i = 0; i < INTSIZE - 2; i++)
+  {
+    result += a[i] * mult;
+    mult *= step;
+  }
+  
+  if (a[INTSIZE - 1] > sgnadd)
+  {
+    result += (a[INTSIZE - 1] - sgnadd) * mult;
+    result *= -1;
+  }
+  else
+    result += a[INTSIZE - 1] * mult;
+  
+  return result;
+}
Index: /branches/network/src/lib/network/converter.h
===================================================================
--- /branches/network/src/lib/network/converter.h	(revision 6106)
+++ /branches/network/src/lib/network/converter.h	(revision 6106)
@@ -0,0 +1,35 @@
+/*!
+ * @file converter.h
+ *  Is able to convert int to byte-array and vice versa
+ */
+ 
+#ifndef _CONVERTER
+#define _CONVERTER
+
+/* include this file, it contains some default definitions */
+#include "netdefs.h"
+
+/* include base_object.h since all classes are derived from this one */
+#include "base_object.h"
+
+/* The size of an int in byte */
+#define INTSIZE 4
+
+/*!
+ * a class that can convert int to byte-array and vice versa
+ */
+class Converter: public BaseObject
+{
+  public:
+    static byte* intToByteArray(int x);
+    static int byteArrayToInt(byte* a);
+    
+    //byte* floatToByteArray(int x);
+    //int byteArrayToFloat(byte[] a);
+    
+  private:
+    Converter();
+    ~Converter();
+};
+
+#endif /*_CONVERTER*/
Index: /branches/network/src/lib/network/entity_manager.h
===================================================================
--- /branches/network/src/lib/network/entity_manager.h	(revision 6105)
+++ /branches/network/src/lib/network/entity_manager.h	(revision 6106)
@@ -10,5 +10,5 @@
 #include "netdefs.h"
 
-/* include base_object.h since all classes are derived from this one */
+/* include synchronizeable.h since this class is derived from this one */
 #include "synchronizeable.h"
 
Index: /branches/network/src/subprojects/network/network_unit_test.cc
===================================================================
--- /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6105)
+++ /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6106)
@@ -11,4 +11,5 @@
 #include "network_stream.h"
 #include "synchronizeable.h"
+#include "converter.h"
 
 #include "simple_sync.h"
@@ -284,4 +285,22 @@
 
 
+int converter(int argc, char** argv)
+{
+  int x = -12;
+  printf("To convert: %i\n", x);
+  byte* res = Converter::intToByteArray(x);
+  for (int i = 0; i < 4; i++)
+    printf("%i  ", res[i]);
+  printf("\n");
+  
+  int z = Converter::byteArrayToInt(res);
+  
+  printf("ReConvert: %i\n", z);
+
+  
+  return 0;
+}
+
+
 
 /**
@@ -308,4 +327,6 @@
     else if (! strcmp( "--listen", argv[i]) || !strcmp("-l", argv[i]))
       return startListen(argc, argv);
+    else if (! strcmp( "--converter", argv[i]) || !strcmp("-o", argv[i]))
+      return converter(argc, argv);
   }
 
