Make leading zeroes optional in the string passed to HexString.toLong

- applies to the individual colon-separated byte components of the string
- for example, you can now use "1:2:3:4:5" instead of "01:02:03:04:05"
- also added back the unit tests for HexString and added some new tests
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java
index ddf0f25..eaeed5f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java
@@ -17,8 +17,6 @@
 
 package org.projectfloodlight.openflow.util;
 
-import java.math.BigInteger;
-
 import org.projectfloodlight.openflow.types.U8;
 
 public class HexString {
@@ -86,13 +84,17 @@
         return ret;
     }
 
-    public static long toLong(final String values) throws NumberFormatException {
-        // Long.parseLong() can't handle HexStrings with MSB set. Sigh.
-        BigInteger bi = new BigInteger(values.replaceAll(":", ""), 16);
-        if (bi.bitLength() > 64)
-            throw new NumberFormatException("Input string too big to fit in long: "
-                    + values);
-        return bi.longValue();
+    public static long toLong(String value) throws NumberFormatException {
+        String[] octets = value.split(":");
+        if (octets.length > 8)
+            throw new NumberFormatException("Input string is too big to fit in long: " + value);
+        long l = 0;
+        for (String octet: octets) {
+            if (octet.length() > 2)
+                throw new NumberFormatException("Each colon-separated byte component must consist of 1 or 2 hex digits: " + value);
+            short s = Short.valueOf(octet, 16);
+            l = (l << 8) + s;
+        }
+        return l;
     }
-
 }