### Question:
NumberUtil { public static Number getExactlyNumber(final String value, final int radix) { BigInteger result = new BigInteger(value, radix); if (result.compareTo(new BigInteger(String.valueOf(Integer.MIN_VALUE))) >= 0 && result.compareTo(new BigInteger(String.valueOf(Integer.MAX_VALUE))) <= 0) { return result.intValue(); } if (result.compareTo(new BigInteger(String.valueOf(Long.MIN_VALUE))) >= 0 && result.compareTo(new BigInteger(String.valueOf(Long.MAX_VALUE))) <= 0) { return result.longValue(); } return result; }  static int roundHalfUp(final Object obj); static Number getExactlyNumber(final String value, final int radix);  }### Answer:
@Test public void assertGetExactlyNumberForInteger() { assertThat(NumberUtil.getExactlyNumber("100000", 10), is((Number) 100000)); assertThat(NumberUtil.getExactlyNumber("100000", 16), is((Number) 1048576)); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Integer.MIN_VALUE), 10), is((Number) Integer.MIN_VALUE)); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Integer.MAX_VALUE), 10), is((Number) Integer.MAX_VALUE)); }
@Test public void assertGetExactlyNumberForLong() { assertThat(NumberUtil.getExactlyNumber("100000000000", 10), is((Number) 100000000000L)); assertThat(NumberUtil.getExactlyNumber("100000000000", 16), is((Number) 17592186044416L)); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Long.MIN_VALUE), 10), is((Number) Long.MIN_VALUE)); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Long.MAX_VALUE), 10), is((Number) Long.MAX_VALUE)); }
@Test public void assertGetExactlyNumberForBigInteger() { assertThat(NumberUtil.getExactlyNumber("10000000000000000000", 10), is((Number) new BigInteger("10000000000000000000"))); assertThat(NumberUtil.getExactlyNumber("10000000000000000000", 16), is((Number) new BigInteger("75557863725914323419136"))); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Long.MIN_VALUE + 1), 10), is((Number) (Long.MIN_VALUE + 1))); assertThat(NumberUtil.getExactlyNumber(String.valueOf(Long.MAX_VALUE - 1), 10), is((Number) (Long.MAX_VALUE - 1))); }