Is Long or double
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; class Main { public static boolean isLong(String text) { try { new Long(text); return true; } catch (NumberFormatException e) { return false; } } public static boolean isDouble(String text) { try { new Double(text); return true; } catch (NumberFormatException e) { return false; } } }