Do not instantiate byte[] needlessly 55/35355/3
authorRobert Varga <rovarga@cisco.com>
Wed, 24 Feb 2016 19:32:46 +0000 (20:32 +0100)
committerMilos Fabian <milfabia@cisco.com>
Wed, 24 Feb 2016 21:57:06 +0000 (21:57 +0000)
Creating a single-byte array is not needed here.

Change-Id: I518419438d6eae6146616fba0725245fc348fee7
Signed-off-by: Robert Varga <rovarga@cisco.com>
util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/main/java/org/opendaylight/protocol/util/Ipv6Util.java

index c6eabf53637f95f4e57fea567247d571f20298cb..e4406dc5668a5b586cfc1d05edd334e7d840f0d5 100644 (file)
@@ -174,7 +174,7 @@ public final class Ipv4Util {
         final List<Ipv4Prefix> list = Lists.newArrayList();
         int byteOffset = 0;
         while (byteOffset < bytes.length) {
-            final int bitLength = UnsignedBytes.toInt(ByteArray.subByte(bytes, byteOffset, 1)[0]);
+            final int bitLength = UnsignedBytes.toInt(bytes[byteOffset]);
             byteOffset += 1;
             // if length == 0, default route will be added
             if (bitLength == 0) {
index cdff9665f81c101f97af911ca2008a72fbbf110e..1f7837fa8beacdb1c2a661296496ef639f547757 100644 (file)
@@ -167,7 +167,7 @@ public final class Ipv6Util {
         final List<Ipv6Prefix> list = Lists.newArrayList();
         int byteOffset = 0;
         while (byteOffset < bytes.length) {
-            final int bitLength = UnsignedBytes.toInt(ByteArray.subByte(bytes, byteOffset, 1)[0]);
+            final int bitLength = UnsignedBytes.toInt(bytes[byteOffset]);
             byteOffset += 1;
             // if length == 0, default route will be added
             if (bitLength == 0) {