Boolean[]
uses about 4-20 bytes per boolean value.boolean[]
uses about 1 byte per boolean value.BitSet
uses about 1 bit per boolean value.
Memory size might not be an issue for you in which case boolean[] might be simpler to code.
More Related Contents:
- Does Java JIT compiler sacrifice performance to favor Collections?
- Array or List in Java. Which is faster?
- Java get available memory
- What is more efficient: System.arraycopy or Arrays.copyOf?
- Size of a byte in memory – Java
- Java: what’s the big-O time of declaring an array of size n?
- Does variable = null set it for garbage collection
- Why does appending “” to a String save memory?
- Java: A two dimensional array is stored in column-major or row-major order?
- Arrays in Java and how they are stored in memory
- Is there a memory-efficient replacement of java.lang.String?
- Hashmap vs Array performance
- JAVA: calculate the average between two or more arrays [closed]
- Write a function that will sort a string array using Java
- Convert list to array in Java [duplicate]
- Converting array to list in Java
- Accessing members of items in a JSONArray with Java
- How to sort an array of objects in Java?
- Should I use Java’s String.format() if performance is important?
- Why does Collections.sort use Mergesort but Arrays.sort does not?
- Why is System.arraycopy native in Java?
- Java Arrays.equals() returns false for two dimensional arrays
- How to convert JSONObjects to JSONArray?
- Java XPath (Apache JAXP implementation) performance
- Should try…catch go inside or outside a loop?
- how calculate java array memory usage
- Java: how much time does an empty loop use?
- Why are new java.util.Arrays methods in Java 8 not overloaded for all the primitive types?
- Array with UserType in Hibernate and PostgreSQL –> MappingException
- Java Memory explained (SUN JVM)