I have the following code snippet as a part of a webservice -
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
calendar.setTime(date);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
return calendar.getTime();
In this, calendar.set(Calendar.MILLISECOND, 0); seems to be taking 152 milliseconds when the concurrency in the system is high. Is it possible to reduce this? Any performance suggestion would be helpful.