Can I declare a 1-bit variable in Java?
•
Java
My algorithm uses a huge Boolean array. As I taught, each boolean variable needs 1 byte Declare a Boolean array anyway and reduce memory usage because I'm dealing with the mobile environment
Editor: my friend and I are discussing whether BitSet is slower than ordinary Boolean arrays Please clarify The algorithm still needs performance as the best requirement
Solution
BitSet
Link to benchmark uses between Boolean and BitSet
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码