java_gen/U64: fix bug with treatment of usigned long values > Long.MAX_VALUE
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/U64.java b/java_gen/pre-written/src/main/java/org/openflow/types/U64.java
index 211c3ea..c0cd475 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/types/U64.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/types/U64.java
@@ -20,8 +20,7 @@
 import java.math.BigInteger;
 
 public class U64 {
-    private final static BigInteger TWO_POWER_64 = BigInteger.valueOf(Long.MAX_VALUE).add(
-            BigInteger.valueOf(1));
+    private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;
 
     private final long raw;
 
@@ -38,8 +37,11 @@
     }
 
     public BigInteger getBigInteger() {
-        return raw >= 0 ? BigInteger.valueOf(raw) : TWO_POWER_64.add(BigInteger
-                .valueOf(raw));
+        BigInteger bigInt = BigInteger.valueOf(raw & UNSIGNED_MASK);
+        if (raw < 0) {
+          bigInt = bigInt.setBit(Long.SIZE - 1);
+        }
+        return bigInt;
     }
 
     @Override
@@ -47,8 +49,12 @@
         return getBigInteger().toString();
     }
 
-    public static BigInteger f(final long i) {
-        return new BigInteger(Long.toBinaryString(i), 2);
+    public static BigInteger f(final long value) {
+        BigInteger bigInt = BigInteger.valueOf(value & UNSIGNED_MASK);
+        if (value < 0) {
+          bigInt = bigInt.setBit(Long.SIZE - 1);
+        }
+        return bigInt;
     }
 
     public static long t(final BigInteger l) {