Use long literal to shorten codes

Change-Id: I7a6c4e32b98aa37ce862ab94cab246889aea986a
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
index 069ead4..9213e4e 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
@@ -41,36 +41,36 @@
 
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SEQUENCE;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 1);
-        segmentAsNumbers.add((long) 2);
-        segmentAsNumbers.add((long) 3);
+        segmentAsNumbers.add(1L);
+        segmentAsNumbers.add(2L);
+        segmentAsNumbers.add(3L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SET;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 4);
-        segmentAsNumbers.add((long) 5);
-        segmentAsNumbers.add((long) 6);
+        segmentAsNumbers.add(4L);
+        segmentAsNumbers.add(5L);
+        segmentAsNumbers.add(6L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 7);
-        segmentAsNumbers.add((long) 8);
-        segmentAsNumbers.add((long) 9);
+        segmentAsNumbers.add(7L);
+        segmentAsNumbers.add(8L);
+        segmentAsNumbers.add(9L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SET;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 10);
-        segmentAsNumbers.add((long) 11);
-        segmentAsNumbers.add((long) 12);
+        segmentAsNumbers.add(10L);
+        segmentAsNumbers.add(11L);
+        segmentAsNumbers.add(12L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
@@ -176,36 +176,36 @@
 
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SEQUENCE;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 1);
-        segmentAsNumbers.add((long) 2);
-        segmentAsNumbers.add((long) 3);
+        segmentAsNumbers.add(1L);
+        segmentAsNumbers.add(2L);
+        segmentAsNumbers.add(3L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SET;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 4);
-        segmentAsNumbers.add((long) 5);
-        segmentAsNumbers.add((long) 6);
+        segmentAsNumbers.add(4L);
+        segmentAsNumbers.add(5L);
+        segmentAsNumbers.add(6L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 7);
-        segmentAsNumbers.add((long) 8);
-        segmentAsNumbers.add((long) 9);
+        segmentAsNumbers.add(7L);
+        segmentAsNumbers.add(8L);
+        segmentAsNumbers.add(9L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
         //
         pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SET;
         segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 10);
-        segmentAsNumbers.add((long) 111);                       // Different
-        segmentAsNumbers.add((long) 12);
+        segmentAsNumbers.add(10L);
+        segmentAsNumbers.add(111L);                       // Different
+        segmentAsNumbers.add(12L);
         pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
         pathSegments.add(pathSegment);
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
index fcd3b86..446056e 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
@@ -99,18 +99,18 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 1);
-        segmentAsNumbers1.add((long) 2);
-        segmentAsNumbers1.add((long) 3);
+        segmentAsNumbers1.add(1L);
+        segmentAsNumbers1.add(2L);
+        segmentAsNumbers1.add(3L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 4);
-        segmentAsNumbers2.add((long) 5);
-        segmentAsNumbers2.add((long) 6);
+        segmentAsNumbers2.add(4L);
+        segmentAsNumbers2.add(5L);
+        segmentAsNumbers2.add(6L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
@@ -191,18 +191,18 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 1);
-        segmentAsNumbers1.add((long) 2);
-        segmentAsNumbers1.add((long) 3);
+        segmentAsNumbers1.add(1L);
+        segmentAsNumbers1.add(2L);
+        segmentAsNumbers1.add(3L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 4);
-        segmentAsNumbers2.add((long) 5);
-        segmentAsNumbers2.add((long) 6);
+        segmentAsNumbers2.add(4L);
+        segmentAsNumbers2.add(5L);
+        segmentAsNumbers2.add(6L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
@@ -245,18 +245,18 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 1);
-        segmentAsNumbers1.add((long) 2);
-        segmentAsNumbers1.add((long) 3);
+        segmentAsNumbers1.add(1L);
+        segmentAsNumbers1.add(2L);
+        segmentAsNumbers1.add(3L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 4);
-        segmentAsNumbers2.add((long) 5);
-        segmentAsNumbers2.add((long) 6);
+        segmentAsNumbers2.add(4L);
+        segmentAsNumbers2.add(5L);
+        segmentAsNumbers2.add(6L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
@@ -293,7 +293,7 @@
         // Get neighbor AS for non-local route
         //
         BgpRouteEntry bgpRouteEntry = generateBgpRouteEntry();
-        assertThat(bgpRouteEntry.getNeighborAs(), is((long) 1));
+        assertThat(bgpRouteEntry.getNeighborAs(), is(1L));
 
         //
         // Get neighbor AS for a local route
@@ -355,18 +355,18 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 1);
-        segmentAsNumbers1.add((long) 2);
-        segmentAsNumbers1.add((long) 3);
+        segmentAsNumbers1.add(1L);
+        segmentAsNumbers1.add(2L);
+        segmentAsNumbers1.add(3L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 4);
-        segmentAsNumbers2.add((long) 5);
-        segmentAsNumbers2.add((long) 6);
+        segmentAsNumbers2.add(4L);
+        segmentAsNumbers2.add(5L);
+        segmentAsNumbers2.add(6L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
@@ -474,18 +474,18 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 1);
-        segmentAsNumbers1.add((long) 2);
-        segmentAsNumbers1.add((long) 3);
+        segmentAsNumbers1.add(1L);
+        segmentAsNumbers1.add(2L);
+        segmentAsNumbers1.add(3L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 4);
-        segmentAsNumbers2.add((long) 5);
-        segmentAsNumbers2.add((long) 6);
+        segmentAsNumbers2.add(4L);
+        segmentAsNumbers2.add(5L);
+        segmentAsNumbers2.add(6L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
index 95bc24b..634e87b 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
@@ -289,9 +289,9 @@
         ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
         byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
-        segmentAsNumbers1.add((long) 65010);
-        segmentAsNumbers1.add((long) 65020);
-        segmentAsNumbers1.add((long) 65030);
+        segmentAsNumbers1.add(65010L);
+        segmentAsNumbers1.add(65020L);
+        segmentAsNumbers1.add(65030L);
         BgpRouteEntry.PathSegment pathSegment1 =
             new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
         pathSegments.add(pathSegment1);
@@ -299,9 +299,9 @@
         //
         byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
         ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
-        segmentAsNumbers2.add((long) 65041);
-        segmentAsNumbers2.add((long) 65042);
-        segmentAsNumbers2.add((long) 65043);
+        segmentAsNumbers2.add(65041L);
+        segmentAsNumbers2.add(65042L);
+        segmentAsNumbers2.add(65043L);
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
         pathSegments.add(pathSegment2);
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
index 3c755e4..516bf57 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
@@ -36,9 +36,9 @@
     private BgpRouteEntry.PathSegment generatePathSegment() {
         byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 1);
-        segmentAsNumbers.add((long) 2);
-        segmentAsNumbers.add((long) 3);
+        segmentAsNumbers.add(1L);
+        segmentAsNumbers.add(2L);
+        segmentAsNumbers.add(3L);
         BgpRouteEntry.PathSegment pathSegment =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
 
@@ -75,9 +75,9 @@
         // Create the fields to compare against
         byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 1);
-        segmentAsNumbers.add((long) 2);
-        segmentAsNumbers.add((long) 3);
+        segmentAsNumbers.add(1L);
+        segmentAsNumbers.add(2L);
+        segmentAsNumbers.add(3L);
 
         // Generate the entry to test
         BgpRouteEntry.PathSegment pathSegment = generatePathSegment();
@@ -107,9 +107,9 @@
         // Setup Path Segment 2
         byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
         ArrayList<Long> segmentAsNumbers = new ArrayList<>();
-        segmentAsNumbers.add((long) 1);
-        segmentAsNumbers.add((long) 22);                        // Different
-        segmentAsNumbers.add((long) 3);
+        segmentAsNumbers.add(1L);
+        segmentAsNumbers.add(22L);                        // Different
+        segmentAsNumbers.add(3L);
         //
         BgpRouteEntry.PathSegment pathSegment2 =
             new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
diff --git a/providers/lldp/src/test/java/org/onosproject/provider/lldp/impl/LLDPLinkProviderTest.java b/providers/lldp/src/test/java/org/onosproject/provider/lldp/impl/LLDPLinkProviderTest.java
index 5adea2f..2e05ce5 100644
--- a/providers/lldp/src/test/java/org/onosproject/provider/lldp/impl/LLDPLinkProviderTest.java
+++ b/providers/lldp/src/test/java/org/onosproject/provider/lldp/impl/LLDPLinkProviderTest.java
@@ -150,7 +150,7 @@
         deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID1, port(DID1, 3, true)));
 
         assertTrue("Port not added to discoverer",
-                   provider.discoverers.get(DID1).containsPort((long) 3));
+                   provider.discoverers.get(DID1).containsPort(3L));
     }
 
     @Test
@@ -162,8 +162,8 @@
 
 
         assertFalse("Port added to discoverer",
-                    provider.discoverers.get(DID1).containsPort((long) 1));
-        assertTrue("Port is not gone.", vanishedPort((long) 1));
+                    provider.discoverers.get(DID1).containsPort(1L));
+        assertTrue("Port is not gone.", vanishedPort(1L));
     }
 
     @Test
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
index 108dbf8..5ec5d7b 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
@@ -125,7 +125,7 @@
         this.factory = factory;
         this.flowRule = flowRule;
         this.selector = flowRule.selector();
-        this.xid = xid.orElse((long) 0);
+        this.xid = xid.orElse(0L);
 
     }