If any object of the java abstract class “Number” is equal to zero
问题 I'm trying to make a generic function that takes any type of Number and conditionally does something if that number is equal to zero. I want anyone to be able to pass it any of the classes that extend Number (BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, or Short) So far, I've attempted to use instanceof to find out what type the number is, then compare it to an equivalent type public static boolean isZero(Number number) { if (number instanceof BigDecimal) { return BigDecimal