### Question:
SizeInt implements IHasDimensionInt { @Nonnull @CheckReturnValue public SizeInt getBestMatchingSize (@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight) { ValueEnforcer.isGT0 (nMaxWidth, "MaxWidth"); ValueEnforcer.isGT0 (nMaxHeight, "MaxHeight"); final double dRelWidth = MathHelper.getDividedDouble (m_nWidth, nMaxWidth); final double dRelHeight = MathHelper.getDividedDouble (m_nHeight, nMaxHeight); if (dRelWidth > dRelHeight) { if (m_nWidth > nMaxWidth) return new SizeInt (nMaxWidth, (int) (m_nHeight / dRelWidth)); } else { if (m_nHeight > nMaxHeight) return new SizeInt ((int) (m_nWidth / dRelHeight), nMaxHeight); } return this; } SizeInt(@Nonnull final IHasDimensionInt aObj);  SizeInt(@Nonnegative final int nWidth, @Nonnegative final int nHeight); @Nonnegative int getWidth(); @Nonnegative int getHeight(); @Nonnull @CheckReturnValue SizeInt getBestMatchingSize(@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight); @Nonnull @CheckReturnValue SizeInt getScaledToWidth(@Nonnegative final int nNewWidth); @Nonnull @CheckReturnValue SizeInt getScaledToHeight(@Nonnegative final int nNewHeight); @Nonnull @CheckReturnValue SizeInt getAdded(@Nonnull final IHasDimensionInt aToAdd); @Nonnull @CheckReturnValue SizeInt getSubtracted(@Nonnull final IHasDimensionInt aToSubtract); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test @SuppressFBWarnings ("RV_RETURN_VALUE_IGNORED") public void testGetBestMatchingSize () { final SizeInt aID = new SizeInt (320, 240); SizeInt aID2 = aID.getBestMatchingSize (160, 180); assertEquals (160, aID2.getWidth ()); assertEquals (120, aID2.getHeight ()); aID2 = aID.getBestMatchingSize (260, 120); assertEquals (160, aID2.getWidth ()); assertEquals (120, aID2.getHeight ()); aID2 = aID.getBestMatchingSize (48, 120); assertEquals (48, aID2.getWidth ()); assertEquals (36, aID2.getHeight ()); assertEquals (aID, aID.getBestMatchingSize (640, 481)); assertEquals (aID, aID.getBestMatchingSize (641, 480)); try { aID2.getBestMatchingSize (0, 100); fail (); } catch (final IllegalArgumentException ex) {} try { final SizeInt aSize = aID2.getBestMatchingSize (100, 0); fail (); assertNull (aSize); } catch (final IllegalArgumentException ex) {} }