Search code examples
javaarraysstringbinaryimage-compression

what data structure should I use to store binary codes in java?


I have binary codes as 10111 , 100011, 11101111 etc. now what data structure should I use to store these codes so that minimum size is required to store them?

I can't use string array as size required will be more as compared than storing the decimal equivalent of above binary codes.


Solution

  • java.util.BitSet is designed for that if the length is not fixed.