@Test
public void testParse() throws ClassNotFoundException {

  final Object[][] testParameters = new Object[][] {{"127", Byte.class, (byte) 127},
      {"128", Short.class, (short) 128}, {"255", Integer.class, 255}, {"256", Long.class, 256L},
      {"511", BigInteger.class, BigInteger.valueOf(511)},
      {"512", BigInteger.class, new BigDecimal("512").toBigInteger()},
      {"1023", Float.class, 1023f}, {"1024", Double.class, 1024d},
      {"2047", BigDecimal.class, new BigDecimal("2047")}};
  for (final Object[] testParameter : testParameters) {
    Object expected = Class.forName(testParameter[2].getClass().getName()).cast(testParameter[2]);
    String text = (String) testParameter[0];
    Class<?> clazz = (Class<?>) testParameter[1];
    assertEquals(expected, NumberUtils.parse(text, clazz));
  }
}