[java] Figuring out whether a number is a Double in Java