isNumber

    public static boolean isNumber(String str)
    {
        Pattern p = Pattern.compile("^([+|-]?)(\\d+\\.\\d+|\\d+\\.?|\\.\\d+)([E|e][+|-]?\\d+)?$");
        Matcher m = p.matcher("-5.5e-12");
        return m.matches();
    }

你可能感兴趣的:(java)