Java does not have sizeof operator now my question is How to find out how much memory is used by an object in Java?
You can use the java.lang.instrumentation package.Here is details of this package: http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/Instrumentation.html
It has a method that can be used to get the implementation specific approximation of object size, as well as overhead associated with the object and follow this link to get a suitable program for your requirement.
http://stackoverflow.com/questions/9368764/calculate-size-of-object-in-java