The sizes for the data types are in the Java Tutorial, here. The size of a boolean is presumably one bit because the value of a boolean can only be true or false. How that value is implemented in the VM can be something different. I would assume that the amount of memory displaced by a boolean would be a word of memory on the native system (4 bytes on most PC OS's).
Originally posted by Rajesh Kesarwani: But is there any way to find out, Boolean type takes 1 bit.
No. The size of a boolean value is an implementation detail of a particular JVM. When you're talking about local variables, they're actually going to be a full machine word. When you're talking about member variables or arrays, it's up to the implementation whether a single byte is used or something larger for padding. There's no way to know other than looking at the source code for a particular JVM.
From the required ranges, it's possible to infer that (for example) a boolean takes a minimum of one bit, or a short takes a minimum of two bytes. But it's entirely possible that, for example, a 64-bit machine might just use 64 bits for every primitive type, just because it's convenient. The javaworld article gives suggestions how you can measure this sort of thing experimentally, but be aware that whatever you learn, it may be completely different on a different machine, or a different JVM version.
"I'm not back." - Bill Harding, Twister
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com