@Test public void equalsWithin(){ float f = 0.15f; float f2 = 0.45f/3; float f3 = 0.46f/3; assertThat(NumberUtil.equalsWithin(f,f2)).isTrue(); assertThat(NumberUtil.equalsWithin(f,f3)).isFalse(); assertThat(NumberUtil.equalsWithin(f,f2,0.0000001)).isTrue(); }
public static boolean equalsWithin(double d1, double d2) { return Math.abs(d1 - d2) < DEFAULT_DOUBLE_EPSILON; }
NumberUtil { public static boolean equalsWithin(double d1, double d2) { return Math.abs(d1 - d2) < DEFAULT_DOUBLE_EPSILON; } }
NumberUtil { public static boolean equalsWithin(double d1, double d2) { return Math.abs(d1 - d2) < DEFAULT_DOUBLE_EPSILON; }  }
NumberUtil { public static boolean equalsWithin(double d1, double d2) { return Math.abs(d1 - d2) < DEFAULT_DOUBLE_EPSILON; }  static boolean equalsWithin(double d1, double d2); static boolean equalsWithin(double d1, double d2, double epsilon); static byte[] toBytes(int value); static byte[] toBytes(long value); static byte[] toBytes(double val); static int toInt(byte[] bytes); static long toLong(byte[] bytes); static double toDouble(byte[] bytes); static boolean isNumber(@Nullable String str); static boolean isHexNumber(@Nullable String value); static int toInt(@NotNull String str); static int toInt(@Nullable String str, int defaultValue); static long toLong(@NotNull String str); static long toLong(@Nullable String str, long defaultValue); static double toDouble(@NotNull String str); static double toDouble(@Nullable String str, double defaultValue); static Integer toIntObject(@NotNull String str); static Integer toIntObject(@Nullable String str, Integer defaultValue); static Long toLongObject(@NotNull String str); static Long toLongObject(@Nullable String str, Long defaultValue); static Double toDoubleObject(@NotNull String str); static Double toDoubleObject(@Nullable String str, Double defaultValue); static Integer hexToIntObject(@NotNull String str); static Integer hexToIntObject(@Nullable String str, Integer defaultValue); static Long hexToLongObject(@NotNull String str); static Long hexToLongObject(@Nullable String str, Long defaultValue); static String toString(int i); static String toString(@NotNull Integer i); static String toString(long l); static String toString(@NotNull Long l); static String toString(double d); static String toString(@NotNull Double d); static String to2DigitString(double d); static int toInt32(long x); }
NumberUtil { public static boolean equalsWithin(double d1, double d2) { return Math.abs(d1 - d2) < DEFAULT_DOUBLE_EPSILON; }  static boolean equalsWithin(double d1, double d2); static boolean equalsWithin(double d1, double d2, double epsilon); static byte[] toBytes(int value); static byte[] toBytes(long value); static byte[] toBytes(double val); static int toInt(byte[] bytes); static long toLong(byte[] bytes); static double toDouble(byte[] bytes); static boolean isNumber(@Nullable String str); static boolean isHexNumber(@Nullable String value); static int toInt(@NotNull String str); static int toInt(@Nullable String str, int defaultValue); static long toLong(@NotNull String str); static long toLong(@Nullable String str, long defaultValue); static double toDouble(@NotNull String str); static double toDouble(@Nullable String str, double defaultValue); static Integer toIntObject(@NotNull String str); static Integer toIntObject(@Nullable String str, Integer defaultValue); static Long toLongObject(@NotNull String str); static Long toLongObject(@Nullable String str, Long defaultValue); static Double toDoubleObject(@NotNull String str); static Double toDoubleObject(@Nullable String str, Double defaultValue); static Integer hexToIntObject(@NotNull String str); static Integer hexToIntObject(@Nullable String str, Integer defaultValue); static Long hexToLongObject(@NotNull String str); static Long hexToLongObject(@Nullable String str, Long defaultValue); static String toString(int i); static String toString(@NotNull Integer i); static String toString(long l); static String toString(@NotNull Long l); static String toString(double d); static String toString(@NotNull Double d); static String to2DigitString(double d); static int toInt32(long x);  }