@Test public void isValidLongTrue() throws Exception { assertTrue(NumberUtilities.isValidLong("12345")); assertTrue(NumberUtilities.isValidLong("-123")); assertTrue(NumberUtilities.isValidLong("999999999999999999", -1999999999999999999L, 1999999999999999999L)); assertTrue(NumberUtilities.isValidLong("999999999999999999", -1999999999999999L, 1999999999999999999L, true, false)); assertTrue(NumberUtilities.isValidLong("123456789123456789", 123456789123456789L, 1123456789123456789L, true, true)); assertTrue(NumberUtilities.isValidLong("999999999999999999", -2, 1999999999999999999L, false, true)); assertTrue(NumberUtilities.isValidLong("-123456789123456789", -1123456789123456789L, 0, false, false)); }
public static boolean isValidLong(@Nullable final String longStr) { if (StringUtils.isBlank(longStr)) { return false; } final String stripedLong = StringUtils.strip(longStr); try { NumberUtils.createLong(stripedLong); return true; } catch (NumberFormatException e) { return false; } }
NumberUtilities { public static boolean isValidLong(@Nullable final String longStr) { if (StringUtils.isBlank(longStr)) { return false; } final String stripedLong = StringUtils.strip(longStr); try { NumberUtils.createLong(stripedLong); return true; } catch (NumberFormatException e) { return false; } } }
NumberUtilities { public static boolean isValidLong(@Nullable final String longStr) { if (StringUtils.isBlank(longStr)) { return false; } final String stripedLong = StringUtils.strip(longStr); try { NumberUtils.createLong(stripedLong); return true; } catch (NumberFormatException e) { return false; } } private  NumberUtilities(); }
NumberUtilities { public static boolean isValidLong(@Nullable final String longStr) { if (StringUtils.isBlank(longStr)) { return false; } final String stripedLong = StringUtils.strip(longStr); try { NumberUtils.createLong(stripedLong); return true; } catch (NumberFormatException e) { return false; } } 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 boolean isValidLong(@Nullable final String longStr) { if (StringUtils.isBlank(longStr)) { return false; } final String stripedLong = StringUtils.strip(longStr); try { NumberUtils.createLong(stripedLong); return true; } catch (NumberFormatException e) { return false; } } 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);  }