@Test public void testTryParseInt() throws Exception { Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt("0")); Assert.assertEquals(Integer.valueOf(123), NumberUtils.tryParseInt("123")); Assert.assertEquals(Integer.valueOf(-123), NumberUtils.tryParseInt("-123")); Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), NumberUtils.tryParseInt(String.valueOf(Integer.MAX_VALUE))); Assert.assertEquals(Integer.valueOf(Integer.MIN_VALUE), NumberUtils.tryParseInt(String.valueOf(Integer.MIN_VALUE))); Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt(null)); Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt(String.valueOf(Long.valueOf(Integer.MAX_VALUE) + 1))); Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt(String.valueOf(Long.valueOf(Integer.MIN_VALUE) - 1))); Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt(String.valueOf("-"))); Assert.assertEquals(Integer.valueOf(0), NumberUtils.tryParseInt(String.valueOf("a"))); }
public static Integer tryParseInt(String number) { return tryParseInt(number, 0); }
NumberUtils { public static Integer tryParseInt(String number) { return tryParseInt(number, 0); } }
NumberUtils { public static Integer tryParseInt(String number) { return tryParseInt(number, 0); } private  NumberUtils(); }
NumberUtils { public static Integer tryParseInt(String number) { return tryParseInt(number, 0); } private  NumberUtils(); static Long tryParseLong(String number); static Long tryParseLong(String number, Long fallback); static Integer tryParseInt(String number); static Integer tryParseInt(String number, Integer fallback); static Float tryParseFloat(String number); static Float tryParseFloat(String number, Float fallback); static Double tryParseDouble(String number); static Double tryParseDouble(String number, Double fallback); static boolean isNumber(String number); }
NumberUtils { public static Integer tryParseInt(String number) { return tryParseInt(number, 0); } private  NumberUtils(); static Long tryParseLong(String number); static Long tryParseLong(String number, Long fallback); static Integer tryParseInt(String number); static Integer tryParseInt(String number, Integer fallback); static Float tryParseFloat(String number); static Float tryParseFloat(String number, Float fallback); static Double tryParseDouble(String number); static Double tryParseDouble(String number, Double fallback); static boolean isNumber(String number); static final String TAG; }