The actual information represented by a boolean value in Java is one bit: 1 for true, 0 for false. However, the actual size of a boolean variable in memory is not precisely defined by the Java specification. See Primitive Data Types in Java.
The boolean data type has only two
possible values: true and false. Use
this data type for simple flags that
track true/false conditions. This data
type represents one bit of
information, but its "size" isn't
something that's precisely defined.
It's undefined; doing things like Jon Skeet suggested will get you an approximation on a given platform, but the way to know precisely for a specific platform is to use a profiler.
If you are thinking about using an array of Boolean objects, don't. Use a BitSet instead - it has some performance optimisations (and some nice extra methods, allowing you to get the next set/unset bit).
I read that Java reserves one byte for a boolean datatype, but it uses only one bit.
However, the documentation says that "its "size" isn't something that's precisely defined".
See here.
Size of the boolean in java is virtual machine dependent.
but Any Java object is aligned to an 8 bytes granularity. A Boolean has 8 bytes of header, plus 1 byte of payload, for a total of 9 bytes of information. The JVM then rounds it up to the next multiple of 8.
so the one instance of java.lang.Boolean takes up 16 bytes of memory.