Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Size of boolean type

Thread view: 
Srinivasa - 16 Aug 2006 06:59 GMT
Hai,
Can anybody tell me the size of primitive data type boolean ?
I didn't get good answer by searching.
Thanks in advance
- Srinivasa Raju Datla
Mike Schilling - 16 Aug 2006 07:19 GMT
> Hai,
> Can anybody tell me the size of primitive data type boolean ?
> I didn't get good answer by searching.
> Thanks in advance

It doesn't have a defined size.  A Java implementation is free to store a
boolean in any fashion that it chooses.
Srinivasa - 16 Aug 2006 07:22 GMT
Thank you Mike :)

> > Hai,
> > Can anybody tell me the size of primitive data type boolean ?
[quoted text clipped - 3 lines]
> It doesn't have a defined size.  A Java implementation is free to store a
> boolean in any fashion that it chooses.
maruthisoft@gmail.com - 16 Aug 2006 16:03 GMT
hi,
1 byte is the size of boolean type
> Thank you Mike :)
>
[quoted text clipped - 5 lines]
> > It doesn't have a defined size.  A Java implementation is free to store a
> > boolean in any fashion that it chooses.
Mike Schilling - 16 Aug 2006 16:19 GMT
> hi,
> 1 byte is the size of boolean type

Why do you say that? Can you prove that a JVM can't represent an array of
booleans using individual bits?
Patricia Shanahan - 16 Aug 2006 16:39 GMT
> Hai,
> Can anybody tell me the size of primitive data type boolean ?
> I didn't get good answer by searching.
> Thanks in advance
> - Srinivasa Raju Datla

It is up to the individual JVM implementation. It is possible that
different amounts of memory will be allocated in different situations.
However, the case that is both most interesting and most measurable is a
large boolean[] array.

I've previously measured it as one byte per element, rounded up to a
multiple of 8 and plus 8 bytes per array overhead. However, your mileage
may vary, and if you really need to know you should measure it on the
system you care about.

Patricia


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.