as we know in java variables are bit holders with a designated type. And for primitives the bits represents a numeric value.
For example. a byte with value 6 has a bit pattern 00000110.
so i wanted to know as boolean is also a primitive what is the bit pattern for it for value true and false.
Internally in the bytecode/VM booleans are represented as bytes with the bit patterns 00000001 for true and 00000000 for false. But that information doesn’t buy you anything as a Java developer as you simply can’t access or otherwise use the numerical represantation of booleans in Java as Java has them strictly seperated from numbers.
Edit: I just looked up the Java VM Spec again and found out my answer was wrong. Contrary to what I said before, booleans are stored as CONSTANT_Integer structs in byte code which makes them occupy 4 bytes for data in the constant pool, but as the constant pool is unified, there can be at most 2 boolean entries in any class. And since a reference to the constant pool is always 2 bytes wide, a array of booleans would occupy 2 bytes per entry in the byte code.