开发者

Is there a std::bitset equivalent (or similar) in Java?

开发者 https://www.devze.com 2023-03-13 18:50 出处:网络
I am looking for a c++ std::bitset equivalent or a similar functionality implementation in Java (1.6 specifically). I tried java.util.BitSet but I am finding that it is not quite similar.

I am looking for a c++ std::bitset equivalent or a similar functionality implementation in Java (1.6 specifically). I tried java.util.BitSet but I am finding that it is not quite similar.

The operations I need are the usual bitwise operations such as AND, OR, etc. If possible, I'd like to be able to set the length of the bitset dynamically (which is unsupported in std::bitset). Can anyone provide a recommendation? Thank开发者_Go百科s.


I don't see what problem you'd have with the normal Bitset class.

The bitset is dynamically grown if necessary (with length() returning the pos of the higehst one bit), so that's basically a fool proof solution.


This can help you?

http://download.oracle.com/javase/tutorial/java/nutsandbolts/op3.html

i don't know how std::bitset work, but you can use bitwise operator in Java and C++ similary

0

精彩评论

暂无评论...
验证码 换一张
取 消