自定义工具类

************判断输入参数是String类型,而需要的0或1的验证[要修改的性别为0或者1]*****************start

public class Test3 {

    public static void main(String[] args) {
        String sex = "11";
        // 判断输入参数是String类型,而需要的0或1的验证[要修改的性别为0或者1]
        if (sex != null && isNum(sex)) {

            double temp = Double.valueOf(sex);
            if (temp == 1 || temp == 0) {
                System.out.println(sex);
            }

        } else {
            System.out.println(sex + "================");
        }

    }

    public static boolean isNum(String str) {

        try {
            new BigDecimal(str);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
*******************************5-15*******************************************************end

猜你喜欢

转载自blog.csdn.net/chai1230/article/details/80324809