I need to fine a monday and sunday of a week if a relavant date is given?
Ex : if i give 2014-Jan-17 is the date i need to find the monday and sunday of relavant week.Can we do this using Java?
If you had used a Calendar object for those calculations, it would have taken care of the case where the month changes. It isn't that hard to do, either... just about every line of code there can be replaced by a similar line acting on a Calendar object.
While the previous posters are absolutely correct about using the Calendar class to do that for you, might I suggest instead of using the built-in Calendar class maybe take a look at a third party calendar library called Joda Time. I have personally found it more useful and easier to use than Calendar class for many situations.