Java获取某年某周的最后一天

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    /** 
     * @Title:LastDayOfWeek.java 
     * @Package:com.you.freemarker.model 
     * @Description:获取某年某周的最后一天 
     * @author:Youhaidong(游海东) 
     * @date:2014-5-29 下午11:42:27 
     * @version V1.0 
     */  
    package com.you.freemarker.model;  
      
    import java.text.SimpleDateFormat;  
    import java.util.Calendar;  
      
    /** 
     * 类功能说明 
     * 类修改者 修改日期 
     * 修改说明 
     * <p>Title:LastDayOfWeek.java</p> 
     * <p>Description:游海东个人开发</p> 
     * <p>Copyright:Copyright(c)2013</p> 
     * @author:游海东 
     * @date:2014-5-29 下午11:42:27 
     * @version V1.0 
     */  
    public class LastDayOfWeek   
    {  
      
        /** 
         * 获取某年某周的最后一天 
         * @Title:getLastDayOfWeek 
         * @Description: 
         * @param:@param year 
         * @param:@param week 
         * @param:@return 
         * @return:String 
         * @throws 
         */  
        public static String getLastDayOfWeek(int year,int week)  
        {  
            Calendar cal = Calendar.getInstance();  
            //设置年份  
            cal.set(Calendar.YEAR,year);  
            //设置周  
            cal.set(Calendar.WEEK_OF_YEAR, week);  
            //设置该周第一天为星期一  
            cal.setFirstDayOfWeek(Calendar.MONDAY);   
            //设置最后一天是星期日  
            cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek() + 6); // Sunday  
            //格式化日期  
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");  
            String lastDayOfWeek = sdf.format(cal.getTime());  
              
            return lastDayOfWeek;  
        }  
          
        /** 
         * @Title:main 
         * @Description: 
         * @param:@param args 
         * @return: void 
         * @throws 
         */  
        public static void main(String[] args)   
        {  
           String lastDay = getLastDayOfWeek(2014,22);  
           System.out.println("2014年第22周的最后一天是:" + lastDay);  
        }  
      
    }