@Test public void testTryParseDouble() throws Exception { Assert.assertEquals(Double.valueOf(0), NumberUtils.tryParseDouble("0")); Assert.assertEquals(Double.valueOf("1.23"), NumberUtils.tryParseDouble("1.23")); Assert.assertEquals(Double.valueOf("-1.23"), NumberUtils.tryParseDouble("-1.23")); Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), NumberUtils.tryParseDouble(String.valueOf(Double.MAX_VALUE))); Assert.assertEquals(Double.valueOf(Double.MAX_EXPONENT), NumberUtils.tryParseDouble(String.valueOf(Double.MAX_EXPONENT))); Assert.assertEquals(Double.valueOf(Double.MIN_VALUE), NumberUtils.tryParseDouble(String.valueOf(Double.MIN_VALUE))); Assert.assertEquals(Double.valueOf(Double.MIN_NORMAL), NumberUtils.tryParseDouble(String.valueOf(Double.MIN_NORMAL))); Assert.assertEquals(Double.valueOf(Double.MIN_EXPONENT), NumberUtils.tryParseDouble(String.valueOf(Double.MIN_EXPONENT))); Assert.assertEquals(Double.valueOf(0), NumberUtils.tryParseDouble(String.valueOf("3.40282346638528860f+38f"))); Assert.assertEquals(Double.valueOf(0), NumberUtils.tryParseDouble(String.valueOf("1.40129846432481707f-45f"))); Assert.assertEquals(Double.valueOf(0), NumberUtils.tryParseDouble(String.valueOf("-"))); Assert.assertEquals(Double.valueOf(0), NumberUtils.tryParseDouble(String.valueOf("a"))); }
public static Double tryParseDouble(String number) { return tryParseDouble(number, 0.d); }
NumberUtils { public static Double tryParseDouble(String number) { return tryParseDouble(number, 0.d); } }
NumberUtils { public static Double tryParseDouble(String number) { return tryParseDouble(number, 0.d); } private  NumberUtils(); }
NumberUtils { public static Double tryParseDouble(String number) { return tryParseDouble(number, 0.d); } 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 Double tryParseDouble(String number) { return tryParseDouble(number, 0.d); } 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; }