@Test public void toDoubleValid() throws Exception { assertTrue(NumberUtilities.toDouble("12345") - 12345 == 0); assertTrue(NumberUtilities.toDouble("-123.99") + 123.99 == 0); assertTrue(NumberUtilities.toDouble(null, 0) == 0); assertTrue(NumberUtilities.toDouble(".111") - 0.111 == 0); }
public static double toDouble(@Nullable final String doubleStr) { if (!isValidDouble(doubleStr)) { throw new IllegalArgumentException(doubleStr + ExceptionValues.EXCEPTION_DELIMITER + ExceptionValues.INVALID_DOUBLE_VALUE); } final String stripedDouble = StringUtils.strip(doubleStr); return NumberUtils.createDouble(stripedDouble); }
NumberUtilities { public static double toDouble(@Nullable final String doubleStr) { if (!isValidDouble(doubleStr)) { throw new IllegalArgumentException(doubleStr + ExceptionValues.EXCEPTION_DELIMITER + ExceptionValues.INVALID_DOUBLE_VALUE); } final String stripedDouble = StringUtils.strip(doubleStr); return NumberUtils.createDouble(stripedDouble); } }
NumberUtilities { public static double toDouble(@Nullable final String doubleStr) { if (!isValidDouble(doubleStr)) { throw new IllegalArgumentException(doubleStr + ExceptionValues.EXCEPTION_DELIMITER + ExceptionValues.INVALID_DOUBLE_VALUE); } final String stripedDouble = StringUtils.strip(doubleStr); return NumberUtils.createDouble(stripedDouble); } private  NumberUtilities(); }
NumberUtilities { public static double toDouble(@Nullable final String doubleStr) { if (!isValidDouble(doubleStr)) { throw new IllegalArgumentException(doubleStr + ExceptionValues.EXCEPTION_DELIMITER + ExceptionValues.INVALID_DOUBLE_VALUE); } final String stripedDouble = StringUtils.strip(doubleStr); return NumberUtils.createDouble(stripedDouble); } private  NumberUtilities(); static boolean isValidInt(@Nullable final String integerStr); static boolean isValidLong(@Nullable final String longStr); static boolean isValidInt(@Nullable final String integerStr, final int lowerBound, final int upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidLong(@Nullable final String longStr, final long lowerBound, final long upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidInt(@Nullable final String integerStr, final int lowerBound, final int upperBound); static boolean isValidLong(@Nullable final String longStr, final long lowerBound, final long upperBound); static int toInteger(@Nullable final String integerStr); static long toLong(@Nullable final String longStr); static int toInteger(@Nullable final String integerStr, final int defaultInteger); static long toLong(@Nullable final String longStr, final long defaultLong); static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound); static boolean isValidDouble(@Nullable final String doubleStr); static double toDouble(@Nullable final String doubleStr); static double toDouble(@Nullable final String doubleStr, final double defaultDouble); }
NumberUtilities { public static double toDouble(@Nullable final String doubleStr) { if (!isValidDouble(doubleStr)) { throw new IllegalArgumentException(doubleStr + ExceptionValues.EXCEPTION_DELIMITER + ExceptionValues.INVALID_DOUBLE_VALUE); } final String stripedDouble = StringUtils.strip(doubleStr); return NumberUtils.createDouble(stripedDouble); } private  NumberUtilities(); static boolean isValidInt(@Nullable final String integerStr); static boolean isValidLong(@Nullable final String longStr); static boolean isValidInt(@Nullable final String integerStr, final int lowerBound, final int upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidLong(@Nullable final String longStr, final long lowerBound, final long upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidInt(@Nullable final String integerStr, final int lowerBound, final int upperBound); static boolean isValidLong(@Nullable final String longStr, final long lowerBound, final long upperBound); static int toInteger(@Nullable final String integerStr); static long toLong(@Nullable final String longStr); static int toInteger(@Nullable final String integerStr, final int defaultInteger); static long toLong(@Nullable final String longStr, final long defaultLong); static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound, final boolean includeLowerBound, final boolean includeUpperBound); static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound); static boolean isValidDouble(@Nullable final String doubleStr); static double toDouble(@Nullable final String doubleStr); static double toDouble(@Nullable final String doubleStr, final double defaultDouble);  }