String转换成int型

private boolean judge(String str){
        int year = 0;
        try{
            year = Integer.valueOf(str).intValue();
        }catch(NumberFormatException e){
            e.printStackTrace();
        }
        
        if(year%4==0 && year%100!=0){
            return true;
        }
        else{
            return false;
        }
    }

 

posted @ 2015-11-05 20:38  喵小喵~  阅读(197)  评论(0编辑  收藏  举报