diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java
index 4a074f17cf9bdaefe2b59a8b90f16a48651a20a5..53e32a347e85d42c584e7bd822e87524fd17e64f 100644
--- a/core/java/src/net/i2p/data/DataHelper.java
+++ b/core/java/src/net/i2p/data/DataHelper.java
@@ -344,8 +344,9 @@ public class DataHelper {
 
         long rv = 0;
         for (int i = 0; i < numBytes; i++) {
-            long cur = rawStream.read() & 0xFF;
+            long cur = rawStream.read();
             if (cur == -1) throw new DataFormatException("Not enough bytes for the field");
+            cur &= 0xFF;
             // we loop until we find a nonzero byte (or we reach the end)
             if (cur != 0) {
                 // ok, data found, now iterate through it to fill the rv
@@ -355,9 +356,10 @@ public class DataHelper {
                     cur = cur << shiftAmount;
                     rv += cur;
                     if (j + 1 < remaining) {
-                        cur = rawStream.read() & 0xFF;
+                        cur = rawStream.read();
                         if (cur == -1)
                             throw new DataFormatException("Not enough bytes for the field");
+                        cur &= 0xFF;
                     }
                 }
                 break;