### Question:
Amount implements Comparable<Amount<T, U>> { public static <U extends Unit<U>> Amount<Double, U> of(double number, U unit) { return new Amount<Double, U>(number, unit, Double.MAX_VALUE) { @Override protected Double scale(double multiplier) { return getValue() * multiplier; } }; } protected  Amount(T value, U unit, T maxValue); T getValue(); U getUnit(); T as(U unit); T asChecked(U unit); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(Amount<T, U> other); static Amount<Double, U> of(double number, U unit); static Amount<Float, U> of(float number, U unit); static Amount<Long, U> of(long number, U unit); static Amount<Integer, U> of(int number, U unit);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testOrderingMixedUnits() { assertEquals( Lists.newArrayList( Amount.of(1, Data.BITS), Amount.of(1, Data.KB), Amount.of(1, Data.MB), Amount.of(1, Data.MB)), Ordering.natural().sortedCopy(Lists.newArrayList( Amount.of(1, Data.KB), Amount.of(1024, Data.KB), Amount.of(1, Data.BITS), Amount.of(1, Data.MB)))); }
@Test @SuppressWarnings("unchecked") public void testOrderingSameUnits() { assertEquals( Lists.newArrayList( Amount.of(1, Time.MILLISECONDS), Amount.of(2, Time.MILLISECONDS), Amount.of(3, Time.MILLISECONDS), Amount.of(4, Time.MILLISECONDS)), Ordering.natural().sortedCopy(Lists.newArrayList( Amount.of(3, Time.MILLISECONDS), Amount.of(2, Time.MILLISECONDS), Amount.of(1, Time.MILLISECONDS), Amount.of(4, Time.MILLISECONDS)))); }