java.util.Calendar.getInstance() // danger
Do not use the method for in your frequently used methods.
instead of creating new instances use
Calendar.setTime(DATE)
otherwise each instance use lots of memory: 432 Bytes
UPDATED:
DO NOT USE LIKE THIS
while(condition){
Calendar calendar = Calendar.getInstance();
calendar.setTime(someDate)
int month = calendar.get(Calendar.MONTH);
}
USE LIKE THIS
Calendar calendar = Calendar.getInstance();
while(condition){
calendar.setTime(someDate)
int month = calendar.get(Calendar.MONTH);
}



You might want to try Joda-Time – http://joda-time.sourceforge.net
hi stephen,
I wish I could use .but this is one of the old project with “do not touch” title
Just make sure you don’t use the Calendar across threads, or synchronize its use.
@Brian
All calendar instance were local in a method,