### Question:
PathWeight implements Comparable<PathWeight> { @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if (first != second) { return first > second ? 1 : -1; } i++; } if (firstSize == secondSize) { return 0; } else { return Integer.compare(firstSize, secondSize); } } PathWeight(long... params);  PathWeight(List<Long> params); PathWeight add(PathWeight toAdd); long toLong(); @Override int compareTo(PathWeight o);  }### Answer:
@Test public void compareTo() { final PathWeight first = new PathWeight(2, 7); final PathWeight second = new PathWeight(5, 7); final PathWeight equalToSecond = new PathWeight(5, 7); final PathWeight third = new PathWeight(7); final PathWeight fourth = new PathWeight(7, 2); assertTrue(first.compareTo(second) < 0); assertTrue(second.compareTo(first) > 0); assertTrue(second.compareTo(equalToSecond) == 0); assertTrue(second.compareTo(third) < 0); assertTrue(third.compareTo(fourth) < 0); assertTrue(fourth.compareTo(third) > 0); }